You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect handling of pg table aliases in JOIN ON clauses when using non-default schema in 7.0.0-alpha.37 #17091
This is essentially a duplicate of #15749 except pertaining to ON clauses rather than WHERE clauses.
I am using Sequelize and Postgres and setting a non-default schema (i.e. not public) when initialising Sequelize. When I make a find call with an include I am seeing that Sequelize is aliasing the FROM table (e.g. FROM "schema"."table" as "Alias") and is using that alias in the ON clause. However, it is producing an invalid statement by prefixing the alias with the schema (e.g. ON "schema"."Alias"."col" ...).
I can workaround the bug by removing the schema from the Sequelize constructor options and instead setting a schema when initialising each model. However, this has some drawbacks e.g. calls such as dropAllEnums use the constructor provided schema.
No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
Reacted by William Metcalf, Benjamin Araya and André Antunes
Activity
WikiRik commentedon Feb 15, 2024
Likely due to this, so if we fix the TODO this issue should also be fixed;
sequelize/packages/core/src/dialects/abstract/query-generator.js
Lines 1590 to 1591 in c8829da
andretunes commentedon Sep 26, 2024
Hello there,
A quick workaround would be to replace the function
quoteTablewithquoteIdentifier. What do you think?Thank you