kysely
kysely copied to clipboard
Postgres 17 mergeInto with USING VALUES()
This is kind of an extension to #1169; the example query used in that issue was:
MERGE INTO heroes AS h
USING (VALUES ('Wade', 'Wilson', 'Deadpool')) AS v(first_name, last_name, hero_name)
ON h.hero_name = v.hero_name
WHEN MATCHED THEN
UPDATE SET first_name = v.first_name, last_name = v.last_name
WHEN NOT MATCHED THEN
INSERT (first_name, last_name, hero_name)
VALUES (v.first_name, v.last_name, v.hero_name)
RETURNING merge_action(), *;
Aside from the RETURNING clause, it also uses VALUES() inside USING, to work from literal data. That doesn't seem possible today, either, since the query builder instance provided inside using() doesn't have a values property.
Is it possible to add this to Kysely?