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
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.
The text was updated successfully, but these errors were encountered:
WikiRik
removed
the
pending-approval
Bug reports that have not been verified yet, or feature requests that have not been accepted yet
label
Feb 15, 2024
Issue Creation Checklist
Bug Description
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.Reproducible Example
I have attempted to create a minimal, reproducible example at https://github.com/chriswheeldon-peakon/sequelize-v7-alias-bug/tree/510d766b06a0062b48d19e76e62134704a1a502d
What do you expect to happen?
Where the table alias is used in the on clause it should not be prefixed with the schema.
What is actually happening?
When using a non-default schema (i.e. not public) then sequelize is prefixing the alias with the schema when referring to it in the join on clause.
Environment
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: