[BUG]: Deeply nested queries fail due to table name length
Problem
What version of `drizzle-orm` are you using? 0.30.1 What version of `drizzle-kit` are you using? 0.20.14 Describe the Bug When creating a query with deeply nested data, the sql generated uses names based on the relation names that have been set up, with more text being appended to the name for each level of depth. "table1" "table1_table2" "table1_table2_table3" etc... If this reaches the limit for the length of a table name, the database will truncate the names to the number of allowed characters, and fail with the error `error: table name "documentVersions_workflowStep_workflow_contract_entities_userEn" specified more than once` because there were multiple more tables in the name that are cut off. They instead all get truncated to the same string which causes an error. Expected behavior Drizzle should either use shorter names upon reaching the limit for a table name, or use aliases within the request that get turned back into the correct names upon response. This ideally should not be something the drizzle user has to worry about, as the query builder should preferably work without having to manually set table names for all the joins. Environment & setup This occurs using postgresql
Error Output
error `error: table name "documentVersions_workflowStep_workflow_contract_entities_userEn" specified more than once` because there were multiple more tables in the name that are cut off. They instead all ge
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [BUG]: Deeply nested queries fail due to table name length
I'm experiencing a similar issue, where the query says the column does not exist due name truncating
Trust Score
5 verifications
- 1
I'm experiencing a similar issue, where the query says the column does not exist
I'm experiencing a similar issue, where the query says the column does not exist due name truncating
Validation
Resolved in drizzle-team/drizzle-orm GitHub issue #2066. Community reactions: 11 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep