-
-
Notifications
You must be signed in to change notification settings - Fork 229
Labels
Description
Motivation
Hey all - Opening this at Huli's request after a discussion on Discord:
It's not currently possible to construct SQL like the following where the CTE consists only of a VALUES list without a query:
WITH data (
field1,
field2,
field3,
field4,
field5
) AS (
VALUES (
'a',
123,
'blah',
333,
1
)
), ins1 AS (
INSERT INTO tableA (col1, col2, col3) SELECT d.field1, d.field2, d.field3 FROM data d RETURNING id as tableA_id
) INSERT INTO tableB (table_a_id, colx, coly) SELECT ins1.tableA_id, d.field4, d.field5 FROM data d CROSS JOIN ins1;