-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Table constraint in column list without comma for table variables and…
… TVFs (#2233) T-SQL allows specifying a table constraint (like PK/UNIQUE) in a column definition without a comma as a separator. Babelfish supports this for tables, but raises an error for table variables and for the table return type in TVFs. This fix inserts a comma in ANTLR for these cases. Signed-off-by: Rob Verschoor [email protected] Task: BABEL-3341
- Loading branch information
1 parent
675ecc1
commit ee1a595
Showing
31 changed files
with
1,260 additions
and
39 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
48 changes: 48 additions & 0 deletions
48
test/JDBC/expected/table_constraint_without_comma-vu-cleanup.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,48 @@ | ||
DROP FUNCTION f1_tvf_nocomma | ||
go | ||
DROP FUNCTION f2_tvf_nocomma | ||
go | ||
DROP FUNCTION f3_tvf_nocomma | ||
go | ||
DROP FUNCTION f4_tvf_nocomma | ||
go | ||
DROP FUNCTION f5_tvf_nocomma | ||
go | ||
DROP FUNCTION f6_tvf_nocomma | ||
go | ||
DROP FUNCTION f7_tvf_nocomma | ||
go | ||
DROP FUNCTION f8_tvf_nocomma | ||
go | ||
DROP FUNCTION f9_tvf_nocomma | ||
go | ||
DROP PROCEDURE p1_tv_nocomma | ||
go | ||
DROP PROCEDURE p2_tv_nocomma | ||
go | ||
DROP PROCEDURE p3_tv_nocomma | ||
go | ||
DROP PROCEDURE p4_tv_nocomma | ||
go | ||
DROP PROCEDURE p5_tv_nocomma | ||
go | ||
DROP PROCEDURE p6_tv_nocomma | ||
go | ||
DROP PROCEDURE p7_tv_nocomma | ||
go | ||
DROP PROCEDURE p8_tv_nocomma | ||
go | ||
DROP PROCEDURE p9_tv_nocomma | ||
go | ||
DROP TABLE t1_tvf_nocomma | ||
go | ||
DROP TABLE t2_tvf_nocomma | ||
go | ||
DROP TABLE t3_tvf_nocomma | ||
go | ||
DROP TABLE t4_tvf_nocomma | ||
go | ||
DROP TABLE t5_tvf_nocomma | ||
go | ||
DROP TABLE t6_tvf_nocomma | ||
go |
153 changes: 153 additions & 0 deletions
153
test/JDBC/expected/table_constraint_without_comma-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,153 @@ | ||
CREATE FUNCTION f1_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL, b INT NOT NULL PRIMARY KEY(a)) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(1,3) | ||
RETURN | ||
END | ||
go | ||
CREATE FUNCTION f2_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL, b INT NOT NULL PRIMARY KEY(a,b)) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(1,2) | ||
RETURN | ||
END | ||
go | ||
CREATE FUNCTION f3_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL, b INT NOT NULL PRIMARY KEY(a)) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(1,3) | ||
RETURN | ||
END | ||
go | ||
CREATE FUNCTION f4_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL, b INT NOT NULL UNIQUE(a,b)) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(1,2) | ||
RETURN | ||
END | ||
go | ||
CREATE FUNCTION f5_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL, b INT NOT NULL PRIMARY KEY) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(2,2) | ||
RETURN | ||
END | ||
go | ||
CREATE FUNCTION f6_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL PRIMARY KEY, b INT NOT NULL) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(1,3) | ||
RETURN | ||
END | ||
go | ||
CREATE FUNCTION f7_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL, b INT NOT NULL UNIQUE) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(2,2) | ||
RETURN | ||
END | ||
go | ||
CREATE FUNCTION f8_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL UNIQUE, b INT NOT NULL) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(1,3) | ||
RETURN | ||
END | ||
go | ||
CREATE FUNCTION f9_tvf_nocomma(@p INT) | ||
RETURNS @tv TABLE (a INT NOT NULL, b INT NOT NULL CHECK(a>0)) | ||
AS | ||
BEGIN | ||
INSERT @tv VALUES(1,2) | ||
IF @p > 0 INSERT @tv VALUES(0,3) | ||
RETURN | ||
END | ||
go | ||
CREATE PROCEDURE p1_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL, b INT NOT NULL PRIMARY KEY(a)) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(1,3) | ||
END | ||
go | ||
CREATE PROCEDURE p2_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL, b INT NOT NULL PRIMARY KEY(a,b)) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(1,2) | ||
END | ||
go | ||
CREATE PROCEDURE p3_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL, b INT NOT NULL PRIMARY KEY(a)) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(1,3) | ||
END | ||
go | ||
CREATE PROCEDURE p4_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL, b INT NOT NULL UNIQUE(a,b)) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(1,2) | ||
END | ||
go | ||
CREATE PROCEDURE p5_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL, b INT NOT NULL PRIMARY KEY) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(2,2) | ||
END | ||
go | ||
CREATE PROCEDURE p6_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL PRIMARY KEY, b INT NOT NULL) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(1,3) | ||
END | ||
go | ||
CREATE PROCEDURE p7_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL, b INT NOT NULL UNIQUE) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(2,2) | ||
END | ||
go | ||
CREATE PROCEDURE p8_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL UNIQUE, b INT NOT NULL) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(1,3) | ||
END | ||
go | ||
CREATE PROCEDURE p9_tv_nocomma | ||
AS | ||
BEGIN | ||
DECLARE @tv TABLE (a INT NOT NULL, b INT NOT NULL CHECK(a>0)) | ||
INSERT @tv VALUES(1,2) | ||
INSERT @tv VALUES(0,3) | ||
END | ||
go |
Oops, something went wrong.