Skip to content

Commit

Permalink
fix(Put): tokenize columns correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Sep 10, 2022
1 parent b4ba9b7 commit d0df076
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/database/query/put.ts
Expand Up @@ -32,15 +32,15 @@ export class Put<T extends TableRef = any> extends Query<Props<T>, 'put'> {
const insertion: TokenArray = [
'INSERT INTO',
mayConflict && nulls.size ? [target, 'this'] : target,
{ tuple: columns },
{ tuple: columns.map(id => ({ id })) },
'VALUES',
{ list: rows },
]

if (mayConflict) {
insertion.push(
'ON CONFLICT',
{ tuple: [table[kPrimaryKey]] },
{ tuple: [{ id: table[kPrimaryKey] }] },
'DO UPDATE SET',
{
list: columns
Expand Down

0 comments on commit d0df076

Please sign in to comment.