fix: support generated keys for WITH queries #1138
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1138 +/- ##
============================================
+ Coverage 67.52% 68.94% +1.42%
- Complexity 3719 3775 +56
============================================
Files 170 170
Lines 15708 15757 +49
Branches 2561 2577 +16
============================================
+ Hits 10607 10864 +257
+ Misses 3906 3658 -248
- Partials 1195 1235 +40 |
So this now adds a returning clause if the query has a with clause ? |
It does so unless returning clause already exists. |
pgjdbc ignored to add RETURNING to WITH queries even though it makes sense. fixes #1104
The corner case here is Current parser is unable to tell
|
This one is valid as well:
|
@@ -198,7 +200,7 @@ public void testMultipleRows() throws SQLException { | |||
public void testSerialWorks() throws SQLException { | |||
Statement stmt = con.createStatement(); | |||
int count = stmt.executeUpdate( | |||
"INSERT INTO genkeys (b,c) VALUES ('a', 2), ('b', 4)" + returningClause + "; ", | |||
"INSERT/*fool parser*/ INTO genkeys (b,c) VALUES ('a', 2), ('b', 4)" + returningClause + "; ", |
davecramer
Mar 12, 2018
Member
can we handle a nested comment ?
can we handle a nested comment ?
vlsi
Mar 12, 2018
Author
Member
parseBlockComment
does handle that case as well. I've added a test case just in case
parseBlockComment
does handle that case as well. I've added a test case just in case
davecramer
Mar 12, 2018
Member
nice!
nice!
Looks good to me |
…omments (pgjdbc#1138) 1) pgjdbc ignored to add RETURNING to WITH queries even though it makes sense. 2) `insert/*comment*/` was not treated as `insert` statement, thus the driver did not add `returning`. fixes pgjdbc#1104
…omments (pgjdbc#1138) 1) pgjdbc ignored to add RETURNING to WITH queries even though it makes sense. 2) `insert/*comment*/` was not treated as `insert` statement, thus the driver did not add `returning`. fixes pgjdbc#1104
pgjdbc ignored to add RETURNING to WITH queries even though it makes sense.
fixes #1104