forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix setval() behaviour in T-SQL mode (babelfish-for-postgresql#803)
We should not change the setval() behaviour in T-SQL dialect as some of the users may use this function as an alternative to DBCC CHECKIDENT for resetting the identity. Task: BABEL-3506 Signed-off-by: Kuntal Ghosh kuntalgh@amazon.com
- Loading branch information
1 parent
e17df72
commit 428ecf7
Showing
19 changed files
with
346 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP SEQUENCE BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1 | ||
go |
78 changes: 78 additions & 0 deletions
78
test/JDBC/expected/BABEL-PG-SYSTEM-FUNCTIONS-vu-prepare.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
-- For DMS, we've suggested the following PG functions related to identity | ||
-- feature that can be called from TDS endpoint and they should get the exact | ||
-- same behaviour as PG endpoint. So, let's add some tests. | ||
-- basic sequence operations for setval, nextval, currentval (tests are taken | ||
-- src/test/regress/sql/sequence.sql PG regression test suite) | ||
CREATE SEQUENCE BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1; | ||
go | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
1 | ||
~~END~~ | ||
|
||
SELECT currval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
1 | ||
~~END~~ | ||
|
||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 32); | ||
go | ||
~~START~~ | ||
bigint | ||
32 | ||
~~END~~ | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
33 | ||
~~END~~ | ||
|
||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 99, false); | ||
go | ||
~~START~~ | ||
bigint | ||
99 | ||
~~END~~ | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
99 | ||
~~END~~ | ||
|
||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 32); | ||
go | ||
~~START~~ | ||
bigint | ||
32 | ||
~~END~~ | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
33 | ||
~~END~~ | ||
|
||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 99, false); | ||
go | ||
~~START~~ | ||
bigint | ||
99 | ||
~~END~~ | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
99 | ||
~~END~~ | ||
|
70 changes: 70 additions & 0 deletions
70
test/JDBC/expected/BABEL-PG-SYSTEM-FUNCTIONS-vu-verify.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
100 | ||
~~END~~ | ||
|
||
SELECT currval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
100 | ||
~~END~~ | ||
|
||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 32); | ||
go | ||
~~START~~ | ||
bigint | ||
32 | ||
~~END~~ | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
33 | ||
~~END~~ | ||
|
||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 99, false); | ||
go | ||
~~START~~ | ||
bigint | ||
99 | ||
~~END~~ | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
99 | ||
~~END~~ | ||
|
||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 32); | ||
go | ||
~~START~~ | ||
bigint | ||
32 | ||
~~END~~ | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
33 | ||
~~END~~ | ||
|
||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 99, false); | ||
go | ||
~~START~~ | ||
bigint | ||
99 | ||
~~END~~ | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
~~START~~ | ||
bigint | ||
99 | ||
~~END~~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP SEQUENCE BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1 | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- For DMS, we've suggested the following PG functions related to identity | ||
-- feature that can be called from TDS endpoint and they should get the exact | ||
-- same behaviour as PG endpoint. So, let's add some tests. | ||
-- basic sequence operations for setval, nextval, currentval (tests are taken | ||
-- src/test/regress/sql/sequence.sql PG regression test suite) | ||
CREATE SEQUENCE BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1; | ||
go | ||
|
||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT currval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 32); | ||
go | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 99, false); | ||
go | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 32); | ||
go | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 99, false); | ||
go | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT currval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 32); | ||
go | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 99, false); | ||
go | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 32); | ||
go | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go | ||
SELECT setval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1', 99, false); | ||
go | ||
SELECT nextval('BABEL_PG_SYSTEM_FUNCTIONS_vu_prepare_seq1'); | ||
go |
Oops, something went wrong.