Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle logical names of columns that are too long? #962

Open
iwashi623 opened this issue Mar 15, 2024 · 1 comment
Open

How to handle logical names of columns that are too long? #962

iwashi623 opened this issue Mar 15, 2024 · 1 comment

Comments

@iwashi623
Copy link

iwashi623 commented Mar 15, 2024

There is a restriction that the string used for AS in PostgresQL must be less than 63 bytes.
https://www.postgresql.org/docs/current/runtime-config-preset.html#GUC-MAX-IDENTIFIER-LENGTH

In bun, logical names used in AS are generated in a format such as table_name__column_name. Logical names exceeding 63 bytes are truncated on the PostgresQL side.

ex: Query Results hoge__bar__piyo__wai__foo__buz__fizz__tic__fuga__boo__column_name -> hoge__bar__piyo__wai__foo__buz__fizz__tic__fuga__boo__column_na

In this example, the result of the query returned from Postgres has the trailing two me characters cut off, so the column/struct mapping does not work on the bun side, resulting in the following error

bun: model=hoge does not have column=hoge__bar__piyo__wai__foo__buz__fizz__tic__fuga__boo__column_na

How can I resolve this one?

@codeliger
Copy link
Contributor

This is a huge issue. Even adding aliases to models doesn't seem to solve the problem. The aliases are not used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants