-
Notifications
You must be signed in to change notification settings - Fork 301
Closed
Description
A call to upsert (Table 1 0) [TableCount +=. 1] generates an SQL query like
INSERT INTO "table" ("unique", "count") VALUES (1,0)
ON CONFLICT ("unique") DO UPDATE
SET "count"="count"+1
WHERE "table"."unique"=1
RETURNING "table"."id", "table"."unique", "table"."count"
Now PostgreSQL complains:
ERROR: column reference "count" is ambiguous
LINE 3: SET "count"="count"+1
To fix this, column "count" should be qualified with the table. Using SET "count"="table"."count"+1 works as expected.
I tested this with PostgreSQL 9.6.2 and Persistent 2.6. Older versions of persistent where multiple queries were used did not have the problem.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels