-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
psql: Upsert ignores conflict_target query parameter #1289
Labels
Comments
This looks like a bug, the PR would be much appreciated 🙏🏾 |
agis
added a commit
to agis/sqlboiler
that referenced
this issue
Jul 14, 2023
The Postgres driver, for the following method call: record.Upsert(ctx, db, false, []string{"foo"}, boil.None(), boil.Infer()) ...would omit the conflict_target parameter[1], i.e. `foo`, from the query: INSERT INTO "cars" ("id", "foo") VALUES ($1,$2) ON CONFLICT DO NOTHING This patch changes the behavior so that the conflict_target is respected, resulting in the following: INSERT INTO "cars" ("id", "foo") VALUES ($1,$2) ON CONFLICT ("foo") DO NOTHING Fixes volatiletech#1289 [1] https://www.postgresql.org/docs/15/sql-insert.html#SQL-ON-CONFLICT
agis
added a commit
to agis/sqlboiler
that referenced
this issue
Jul 14, 2023
The Postgres driver, for the following method call: record.Upsert(ctx, db, false, []string{"foo"}, boil.None(), boil.Infer()) ...would omit the conflict_target parameter[1], i.e. `foo`, from the query: INSERT INTO "cars" ("id", "foo") VALUES ($1,$2) ON CONFLICT DO NOTHING This patch changes the behavior so that the conflict_target is respected, resulting in the following: INSERT INTO "cars" ("id", "foo") VALUES ($1,$2) ON CONFLICT ("foo") DO NOTHING Fixes volatiletech#1289 [1] https://www.postgresql.org/docs/15/sql-insert.html#SQL-ON-CONFLICT
@stephenafamo can we please backport this to v4, since it seems to me like a trivial bugfix? |
I just need to cut a new release soon. We're still on v4 |
Thanks a lot, that would be greatly appreciated! |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
What version of SQLBoiler are you using (
sqlboiler --version
)?4.11.0
What is your database and version (eg. Postgresql 10)
Postgres 13
If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)
N/A
If this happened at runtime what code produced the issue? (if not applicable leave blank)
N/A
What is the output of the command above with the
-d
flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)N/A
Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
Further information. What did you do, what did you expect?
The following call:
results in the following unexpected query:
whereas I would expect it to result to the following:
I've a draft PR ready if this is indeed a bug and not something I'm misunderstanding.
The text was updated successfully, but these errors were encountered: