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

[BUG] Missing quotes when using Relation with schema #649

Closed
Fliskr opened this issue Aug 15, 2022 · 0 comments
Closed

[BUG] Missing quotes when using Relation with schema #649

Fliskr opened this issue Aug 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Fliskr
Copy link

Fliskr commented Aug 15, 2022

When database has schema and you try to establish relation it throws an error because of missing quotes in join table name:
ERROR: relation "schema.table2" does not exist (SQLSTATE=42P01)

The output query looks like:
SELECT * FROM "schema"."table1" AS "t1" JOIN schema.table2 AS "t2" ON ("t1"."t2.id") ...

Should be like:
SELECT * FROM "schema"."table1" AS "t1" JOIN "schema"."table2" AS "t2" ON ("t1"."t2.id") ...

m2mQuery method should use:
join = fmter.AppendQuery(join, string(j.Relation.M2MTable.SQLName))
instead of:
join = fmter.AppendQuery(join, string(j.Relation.M2MTable.Name))

image

@vmihailenco vmihailenco added the bug Something isn't working label Aug 16, 2022
vmihailenco added a commit that referenced this issue Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants