Skip to content

Commit

Permalink
Update expected output of some test files when parallel query is enfo…
Browse files Browse the repository at this point in the history
…rced (2_X_DEV) (#2187)

Update expected output of some test files in case of parallel query as query plan changed. Also unblock these tests from parallel query jdbc ignore file. 

Cherry-pick commit 8efbb63 from BABEL_3_X_DEV to BABEL_2_X_DEV. 

Reason for expected output diff in case of parallel query mode - 

```
# Output rows ORDER changes.
BABEL-2514 - order changes because of UNION
BABEL-2998 - order changes because of UNION  (updated expected output for this according to BABEL_2_X_DEV as commit that fixed this tests is not cherry-picked from BABEL_3_X_DEV)
BABEL-328-vu-verify - order changes because of JOIN
TestSQLQueries - order changes because of JOIN

BABEL-1444 - We don't share state of the GUC "role" with parallel worker which will result in current_setting('role') to return none

# Query plan change
BABEL-1363
BABEL-2843
BABEL-2844
BABEL-2902
BABEL-2903
BABEL-3248
BABEL-3295
BABEL-3513-vu-prepare
BABEL-3513-vu-verify
BABEL-4281
babel_collection
binary-index-vu-verify

```

Task: BABEL-4643
Signed-off-by: Sandeep Kumawat <[email protected]>
  • Loading branch information
skumawat2025 authored Jan 2, 2024
1 parent 1f4e191 commit 71dd99f
Show file tree
Hide file tree
Showing 34 changed files with 4,768 additions and 34 deletions.
1 change: 1 addition & 0 deletions contrib/babelfishpg_tsql/sql/test/babel_collation.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- parallel_query_expected
-- nvarchar is not supported in PG
create table testing1(col nvarchar(60)); -- expect this to fail in the Postgres dialect

Expand Down
1 change: 0 additions & 1 deletion test/JDBC/expected/BABEL-2902.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

-- psql
-- Test setup --
ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'multi-db';
Expand Down
263 changes: 263 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-1444.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
USE MASTER;
GO

DECLARE @usr CHAR(30)
DECLARE @cur_usr CHAR(30)
SET @usr = user
SET @cur_usr = current_user
SELECT 'user: '+ @usr
SELECT 'current_user: '+ @cur_usr
GO
~~START~~
varchar
user: dbo
~~END~~

~~START~~
varchar
current_user: dbo
~~END~~


CREATE TABLE dbo.t1
(id INT IDENTITY(100, 1) NOT NULL,
description VARCHAR(30) NOT NULL,
usr VARCHAR(30) NOT NULL DEFAULT USER,
cur_usr VARCHAR(30) NOT NULL DEFAULT CURRENT_USER);
GO

INSERT INTO dbo.t1 (description) VALUES ('Orange');
INSERT INTO dbo.t1 (description) VALUES ('Blue');
INSERT INTO dbo.t1 (description, usr) VALUES ('Green', 'Bob');
INSERT INTO dbo.t1 (description, cur_usr) VALUES ('Purple', 'Alice');
INSERT INTO dbo.t1 (description, usr, cur_usr) VALUES ('Red', 'Mike', 'Dave');
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~


SELECT * FROM dbo.t1 ORDER BY id;
GO
~~START~~
int#!#varchar#!#varchar#!#varchar
100#!#Orange#!#dbo#!#dbo
101#!#Blue#!#dbo#!#dbo
102#!#Green#!#Bob#!#dbo
103#!#Purple#!#dbo#!#Alice
104#!#Red#!#Mike#!#Dave
~~END~~


DROP TABLE dbo.t1;
GO

-- Test properties after USE
CREATE DATABASE db1;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
master_dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


USE db1;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


-- Error: Test DROP
DROP DATABASE db1;
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot drop database "db1" because it is currently in use)~~


SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


-- Test DROP when using another database
USE MASTER;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
master_dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


DROP DATABASE db1;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
master_dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


-- Test CREATE
CREATE DATABASE db1;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
master_dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


-- Clean up
DROP DATABASE db1;
GO
Loading

0 comments on commit 71dd99f

Please sign in to comment.