Closed lammertw closed 1 year ago
I have a table with a column named user (which contains an id referring to my own users table). In Postgres, user is a reserved word, which means it's required to put quotes around it when using it in SQL.
I have the following code:
UsageInfos.upsert( conflictColumn = UsageInfos.user, insertBody = { it[user] = id it[other] = "Value" }, updateBody = { it[other] = "Value" } )
Which results in the following SQL: INSERT INTO usageinfos ("other", "user") VALUES ('Value', 86) ON CONFLICT(user) DO UPDATE SET "other"='Value'
INSERT INTO usageinfos ("other", "user") VALUES ('Value', 86) ON CONFLICT(user) DO UPDATE SET "other"='Value'
Because CONFLICT(user) is missing quotes, this results in an error.
CONFLICT(user)
The correct SQL should be: INSERT INTO usageinfos ("other", "user") VALUES ('Value', 86) ON CONFLICT("user") DO UPDATE SET "other"='Value'
INSERT INTO usageinfos ("other", "user") VALUES ('Value', 86) ON CONFLICT("user") DO UPDATE SET "other"='Value'
I have a table with a column named user (which contains an id referring to my own users table). In Postgres, user is a reserved word, which means it's required to put quotes around it when using it in SQL.
I have the following code:
Which results in the following SQL:
INSERT INTO usageinfos ("other", "user") VALUES ('Value', 86) ON CONFLICT(user) DO UPDATE SET "other"='Value'
Because
CONFLICT(user)
is missing quotes, this results in an error.The correct SQL should be:
INSERT INTO usageinfos ("other", "user") VALUES ('Value', 86) ON CONFLICT("user") DO UPDATE SET "other"='Value'