· 6 years ago · Aug 21, 2019, 03:18 AM
1DROP TABLE IF EXISTS __test;
2CREATE TEMPORARY TABLE __test
3(
4 id int not null,
5 value text not null
6);
7
8WITH things AS (
9 INSERT INTO __test
10 VALUES (1, 'foo'),
11 (2, 'bar'),
12 (2, 'baz')
13 RETURNING *
14)
15SELECT id,
16 array_agg(value)
17FROM things
18GROUP BY id;
19
20val insertQuery = DSL
21 .insertInto(otherTable)
22 .select(
23 DSL.select(recordPkColumns)
24 .from(recordTable)
25 .crossJoin(permValues)
26 .where(filter(command.command))
27 )
28 .onConflictDoNothing()
29 .returning()
30
31DSL.select()
32 .from(insertQuery) // problem is here!