Skip to content

Commit 428baf7

Browse files
committed
Add test cases for scenarios where RETURNING is used in standard (non-upsert) queries.
1 parent 65d9df4 commit 428baf7

File tree

6 files changed

+60
-0
lines changed

6 files changed

+60
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DELETE FROM x
2+
WHERE id IN ( SELECT id, name
3+
FROM x2
4+
WHERE id > /* id */101 AND div = 't' )
5+
returning id, name
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DELETE FROM x
2+
WHERE id IN ( SELECT id
3+
, name
4+
FROM x2
5+
WHERE id > /* id */101
6+
AND div = 't' )
7+
RETURNING id
8+
, name
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
INSERT INTO /*# tableName */
2+
(x1 , x2
3+
/*%for entity : entities */
4+
, /*# entity.itemIdentifier */
5+
/*%end*/ , x3 , x4)
6+
VALUES ( /* reportId */1
7+
, /* reportId */1
8+
/*%for entity : entities */
9+
, /* entity.value */'abc'
10+
/*%end*/
11+
, /* @userId() */1
12+
, x5
13+
, /* @userId() */1
14+
, x6, 1
15+
, /* @maxDateTime() */'9999-12-31') returning x1, x2
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
INSERT INTO /*# tableName */
2+
(x1
3+
, x2
4+
/*%for entity : entities */
5+
, /*# entity.itemIdentifier */
6+
/*%end*/
7+
, x3
8+
, x4)
9+
VALUES ( /* reportId */1
10+
, /* reportId */1
11+
/*%for entity : entities */
12+
, /* entity.value */'abc'
13+
/*%end*/
14+
, /* @userId() */1
15+
, x5
16+
, /* @userId() */1
17+
, x6
18+
, 1
19+
, /* @maxDateTime() */'9999-12-31')
20+
RETURNING x1
21+
, x2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
update user set
2+
name = /* user.name */'name',
3+
rank = /*user.rank */3
4+
where id = /* user.id */1 returning id, name, rank
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
UPDATE user
2+
SET name = /* user.name */'name'
3+
, rank = /*user.rank */3
4+
WHERE id = /* user.id */1
5+
RETURNING id
6+
, name
7+
, rank

0 commit comments

Comments
 (0)