Skip to content

Commit

Permalink
Add new tests for mixed temp and permanent tables in transaction.
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Teng <[email protected]>
  • Loading branch information
Jason Teng committed Sep 23, 2024
1 parent fb9b76e commit c37c900
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/JDBC/expected/temp_table_rollback-vu-cleanup.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ GO

DROP PROCEDURE tv_base_rollback
GO

DROP PROCEDURE tv_tt_no_error
GO
10 changes: 10 additions & 0 deletions test/JDBC/expected/temp_table_rollback-vu-prepare.out
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@ BEGIN
INSERT INTO @tv VALUES (1)
END
GO

CREATE PROCEDURE tv_tt_no_error AS
BEGIN
DECLARE @tv TABLE (a int)
CREATE TABLE #t1 (a int)
INSERT INTO temp_tab_rollback_mytab VALUES (1)
INSERT INTO @tv VALUES (1)
INSERT INTO #t1 VALUES (1)
END
GO
69 changes: 69 additions & 0 deletions test/JDBC/expected/temp_table_rollback-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,75 @@ int
~~END~~


BEGIN TRAN
INSERT INTO temp_tab_rollback_mytab VALUES (2)
EXEC tv_tt_no_error
SELECT * FROM temp_tab_rollback_mytab
DROP TABLE temp_tab_rollback_mytab
ROLLBACK
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~START~~
int
2
1
~~END~~


SELECT * FROM temp_tab_rollback_mytab
GO
~~START~~
int
~~END~~


BEGIN TRAN
INSERT INTO temp_tab_rollback_mytab VALUES (2)
CREATE TABLE #outer_table (a int)
INSERT INTO #outer_table VALUES (1)
EXEC tv_tt_no_error
SELECT * FROM temp_tab_rollback_mytab
DROP TABLE temp_tab_rollback_mytab
ROLLBACK
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~START~~
int
2
1
~~END~~


SELECT * FROM temp_tab_rollback_mytab
GO
~~START~~
int
~~END~~


SELECT * FROM #outer_table
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: relation "#outer_table" does not exist)~~


DROP TABLE temp_tab_rollback_mytab
GO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ BEGIN
END
GO

CREATE PROCEDURE tv_tt_no_error AS
BEGIN
DECLARE @tv TABLE (a int)
CREATE TABLE #t1 (a int)
INSERT INTO temp_tab_rollback_mytab VALUES (1)
INSERT INTO @tv VALUES (1)
INSERT INTO #t1 VALUES (1)
END
GO

-- pg_class, pg_type, pg_depend, pg_attribute, pg_constraint, pg_index, pg_sequence are all covered by below tests.
-------------------------------
-- Temp Table CREATE + ROLLBACK
Expand Down Expand Up @@ -927,6 +937,75 @@ int
~~END~~


BEGIN TRAN
INSERT INTO temp_tab_rollback_mytab VALUES (2)
EXEC tv_tt_no_error
SELECT * FROM temp_tab_rollback_mytab
DROP TABLE temp_tab_rollback_mytab
ROLLBACK
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~START~~
int
2
1
~~END~~


SELECT * FROM temp_tab_rollback_mytab
GO
~~START~~
int
~~END~~


BEGIN TRAN
INSERT INTO temp_tab_rollback_mytab VALUES (2)
CREATE TABLE #outer_table (a int)
INSERT INTO #outer_table VALUES (1)
EXEC tv_tt_no_error
SELECT * FROM temp_tab_rollback_mytab
DROP TABLE temp_tab_rollback_mytab
ROLLBACK
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~START~~
int
2
1
~~END~~


SELECT * FROM temp_tab_rollback_mytab
GO
~~START~~
int
~~END~~


SELECT * FROM #outer_table
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: relation "#outer_table" does not exist)~~


DROP TABLE temp_tab_rollback_mytab
GO

Expand Down Expand Up @@ -1398,3 +1477,6 @@ GO

DROP PROCEDURE tv_base_rollback
GO

DROP PROCEDURE tv_tt_no_error
GO
82 changes: 82 additions & 0 deletions test/JDBC/expected/temp_table_rollback_isolation_snapshot.out
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ BEGIN
END
GO

CREATE PROCEDURE tv_tt_no_error AS
BEGIN
DECLARE @tv TABLE (a int)
CREATE TABLE #t1 (a int)
INSERT INTO temp_tab_rollback_mytab VALUES (1)
INSERT INTO @tv VALUES (1)
INSERT INTO #t1 VALUES (1)
END
GO

-- pg_class, pg_type, pg_depend, pg_attribute, pg_constraint, pg_index, pg_sequence are all covered by below tests.
-------------------------------
-- Temp Table CREATE + ROLLBACK
Expand Down Expand Up @@ -927,6 +937,75 @@ int
~~END~~


BEGIN TRAN
INSERT INTO temp_tab_rollback_mytab VALUES (2)
EXEC tv_tt_no_error
SELECT * FROM temp_tab_rollback_mytab
DROP TABLE temp_tab_rollback_mytab
ROLLBACK
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~START~~
int
2
1
~~END~~


SELECT * FROM temp_tab_rollback_mytab
GO
~~START~~
int
~~END~~


BEGIN TRAN
INSERT INTO temp_tab_rollback_mytab VALUES (2)
CREATE TABLE #outer_table (a int)
INSERT INTO #outer_table VALUES (1)
EXEC tv_tt_no_error
SELECT * FROM temp_tab_rollback_mytab
DROP TABLE temp_tab_rollback_mytab
ROLLBACK
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~START~~
int
2
1
~~END~~


SELECT * FROM temp_tab_rollback_mytab
GO
~~START~~
int
~~END~~


SELECT * FROM #outer_table
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: relation "#outer_table" does not exist)~~


DROP TABLE temp_tab_rollback_mytab
GO

Expand Down Expand Up @@ -1398,3 +1477,6 @@ GO

DROP PROCEDURE tv_base_rollback
GO

DROP PROCEDURE tv_tt_no_error
GO
82 changes: 82 additions & 0 deletions test/JDBC/expected/temp_table_rollback_xact_abort_on.out
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ BEGIN
END
GO

CREATE PROCEDURE tv_tt_no_error AS
BEGIN
DECLARE @tv TABLE (a int)
CREATE TABLE #t1 (a int)
INSERT INTO temp_tab_rollback_mytab VALUES (1)
INSERT INTO @tv VALUES (1)
INSERT INTO #t1 VALUES (1)
END
GO

-- pg_class, pg_type, pg_depend, pg_attribute, pg_constraint, pg_index, pg_sequence are all covered by below tests.
-------------------------------
-- Temp Table CREATE + ROLLBACK
Expand Down Expand Up @@ -928,6 +938,75 @@ int
~~END~~


BEGIN TRAN
INSERT INTO temp_tab_rollback_mytab VALUES (2)
EXEC tv_tt_no_error
SELECT * FROM temp_tab_rollback_mytab
DROP TABLE temp_tab_rollback_mytab
ROLLBACK
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~START~~
int
2
1
~~END~~


SELECT * FROM temp_tab_rollback_mytab
GO
~~START~~
int
~~END~~


BEGIN TRAN
INSERT INTO temp_tab_rollback_mytab VALUES (2)
CREATE TABLE #outer_table (a int)
INSERT INTO #outer_table VALUES (1)
EXEC tv_tt_no_error
SELECT * FROM temp_tab_rollback_mytab
DROP TABLE temp_tab_rollback_mytab
ROLLBACK
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~START~~
int
2
1
~~END~~


SELECT * FROM temp_tab_rollback_mytab
GO
~~START~~
int
~~END~~


SELECT * FROM #outer_table
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: relation "#outer_table" does not exist)~~


DROP TABLE temp_tab_rollback_mytab
GO

Expand Down Expand Up @@ -1399,3 +1478,6 @@ GO

DROP PROCEDURE tv_base_rollback
GO

DROP PROCEDURE tv_tt_no_error
GO
Loading

0 comments on commit c37c900

Please sign in to comment.