Skip to content

Commit

Permalink
mvu test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhibai Song committed Nov 14, 2023
1 parent 33b8906 commit 503748e
Show file tree
Hide file tree
Showing 28 changed files with 460 additions and 407 deletions.
1 change: 0 additions & 1 deletion contrib/babelfishpg_tsql/src/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ InstallExtendedHooks(void)

prev_optimize_explicit_cast_hook = optimize_explicit_cast_hook;
optimize_explicit_cast_hook = optimize_explicit_cast;

}

void
Expand Down
1 change: 0 additions & 1 deletion contrib/babelfishpg_tsql/src/pl_exec-2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3357,7 +3357,6 @@ int exec_stmt_dbcc(PLtsql_execstate *estate, PLtsql_stmt_dbcc *stmt)
return PLTSQL_RC_OK;
}


void exec_stmt_dbcc_checkident(PLtsql_stmt_dbcc *stmt)
{
struct dbcc_checkident dbcc_stmt = stmt->dbcc_stmt_data.dbcc_checkident;
Expand Down
29 changes: 29 additions & 0 deletions test/JDBC/expected/BABEL-2999-vu-cleanup.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
drop table if exists t2_BABEL2999;
GO

drop table t1_BABEL2999;
GO

drop table t3_BABEL2999;
GO

drop table t3_BABEL2999_2;
GO

drop procedure p1_BABEL2999;
GO

drop procedure p2_BABEL2999
GO

drop procedure p3_BABEL2999
GO

drop table t4_BABEL2999;
GO

drop table t5_BABEL2999;
GO

drop table t6_BABEL2999
GO
32 changes: 32 additions & 0 deletions test/JDBC/expected/BABEL-2999-vu-prepare.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
drop table if exists t1_BABEL2999;
GO

create table t1_BABEL2999(b varchar(10));
GO

create table t2_BABEL2999(b int);
GO

create table t3_BABEL2999(b varchar);
GO

create procedure p1_BABEL2999 as select 'abc';
GO

create procedure p2_BABEL2999 as select 555;
GO

create table t3_BABEL2999_2(a int, b datetime, c varchar(20))
GO

create procedure p3_BABEL2999 as select '123', 123, 123;
GO

create table t4_BABEL2999( a binary(30), b varbinary(30), c varchar(30), d datetime, e smalldatetime)
GO

create table t5_BABEL2999( a decimal, b numeric)
GO

create table t6_BABEL2999( a int, b tinyint, c smallint)
GO
216 changes: 216 additions & 0 deletions test/JDBC/expected/BABEL-2999-vu-verify.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
insert into t1_BABEL2999 exec('Select ''5''');
GO
~~ROW COUNT: 1~~


insert into t1_BABEL2999 exec('Select 5');
GO
~~ROW COUNT: 1~~


insert into t1_BABEL2999 exec('Select ''5''');
GO
~~ROW COUNT: 1~~


insert into t1_BABEL2999 exec('Select ''hello''');
GO
~~ROW COUNT: 1~~


insert into t1_BABEL2999 exec('SELECT ''helloworld''');
GO
~~ROW COUNT: 1~~


insert into t1_BABEL2999 exec('SELECT ''helloworldhello''');
GO
~~ERROR (Code: 8152)~~

~~ERROR (Message: value too long for type character varying(10))~~


select b from t1_BABEL2999 order by b;
GO
~~START~~
varchar
5
5
5
hello
helloworld
~~END~~


insert into t2_BABEL2999 exec('Select ''5'''); -- varchar to int
GO
~~ROW COUNT: 1~~


insert into t2_BABEL2999 exec('Select 5'); -- int to int
GO
~~ROW COUNT: 1~~


insert into t2_BABEL2999 SELECT '5';
GO
~~ROW COUNT: 1~~


select b from t2_BABEL2999 order by b;
GO
~~START~~
int
5
5
5
~~END~~


insert into t3_BABEL2999 exec('Select ''5''');
GO
~~ROW COUNT: 1~~


insert into t3_BABEL2999 exec('Select 5');
GO
~~ROW COUNT: 1~~


insert into t3_BABEL2999 exec('Select ''5''');
GO
~~ROW COUNT: 1~~


select b from t3_BABEL2999 order by b;
GO
~~START~~
varchar
5
5
5
~~END~~


delete from t1_BABEL2999
GO
~~ROW COUNT: 5~~


insert into t1_BABEL2999 exec p1_BABEL2999;
GO
~~ROW COUNT: 1~~


insert into t1_BABEL2999 exec('exec p1_BABEL2999');
GO
~~ROW COUNT: 1~~


select * from t1_BABEL2999;
GO
~~START~~
varchar
abc
abc
~~END~~


insert t3_BABEL2999_2 exec('select ''123'', 123, 123');
GO
~~ROW COUNT: 1~~


insert into t3_BABEL2999_2 exec p3_BABEL2999
GO
~~ROW COUNT: 1~~


insert into t3_BABEL2999_2 select '123', 123, 123
GO
~~ROW COUNT: 1~~


select * from t3_BABEL2999_2;
GO
~~START~~
int#!#datetime#!#varchar
123#!#1900-05-04 00:00:00.0#!#123
123#!#1900-05-04 00:00:00.0#!#123
123#!#1900-05-04 00:00:00.0#!#123
~~END~~


insert into t3_BABEL_2999_2 exec('select ''123''');
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: relation "t3_babel_2999_2" does not exist)~~


insert into t3_BABEL_2999_2 exec('select 123, 123');
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: relation "t3_babel_2999_2" does not exist)~~


insert into t4_BABEL2999 exec('select 123, 123, 123, 123, 123')
GO
~~ROW COUNT: 1~~


insert into t4_BABEL2999 exec('select cast(123 as binary), cast(123 as varbinary), 123, cast(123 as datetime), cast(123 as smalldatetime)')
GO
~~ROW COUNT: 1~~


insert into t4_BABEL2999 select 123, 123, 123, 123, 123
GO
~~ROW COUNT: 1~~


insert into t4_BABEL2999 exec('select ''123'', ''123'', ''123'', ''123'', ''123''');
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Implicit conversion from data type varchar to binary is not allowed. Use the CONVERT function to run this query.)~~


select * from t4_BABEL2999
GO
~~START~~
binary#!#varbinary#!#varchar#!#datetime#!#smalldatetime
00000000000000000000000000000000000000000000000000000000007B#!#0000007B#!#123#!#1900-05-04 00:00:00.0#!#1900-05-04 00:00:00.0
00000000000000000000000000000000000000000000000000000000007B#!#0000007B#!#123#!#1900-05-04 00:00:00.0#!#1900-05-04 00:00:00.0
00000000000000000000000000000000000000000000000000000000007B#!#0000007B#!#123#!#1900-05-04 00:00:00.0#!#1900-05-04 00:00:00.0
~~END~~


insert into t5_BABEL2999 exec('select ''1.234'', ''33.33''');
GO
~~ROW COUNT: 1~~


select * from t5_BABEL2999
GO
~~START~~
numeric#!#numeric
1#!#33
~~END~~


insert into t6_BABEL2999 exec('select 1,2,3')
GO
~~ROW COUNT: 1~~


insert into t6_BABEL2999 exec('select ''1'',''2'',''3''')
GO
~~ROW COUNT: 1~~


insert into t6_BABEL2999 exec('select c,b,a from t6_BABEL2999')
GO
~~ROW COUNT: 2~~

Loading

0 comments on commit 503748e

Please sign in to comment.