From 71dd99f1abbd8eeef4e1f56f3f0608f6f2612fd4 Mon Sep 17 00:00:00 2001 From: Sandeep Kumawat <2025sandeepkumawat@gmail.com> Date: Tue, 2 Jan 2024 16:06:40 +0530 Subject: [PATCH] Update expected output of some test files when parallel query is enforced (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 8efbb63ad573cc78827e94c954d4968ea7bdeebd 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 --- .../sql/test/babel_collation.sql | 1 + test/JDBC/expected/BABEL-2902.out | 1 - .../expected/parallel_query/BABEL-1444.out | 263 +++++ .../expected/parallel_query/BABEL-2514.out | 199 ++++ .../expected/parallel_query/BABEL-2843.out | 418 ++++++++ .../expected/parallel_query/BABEL-2844.out | 392 ++++++++ .../expected/parallel_query/BABEL-2902.out | 587 ++++++++++++ .../expected/parallel_query/BABEL-2903.out | 113 +++ .../expected/parallel_query/BABEL-2998.out | 99 ++ .../expected/parallel_query/BABEL-3248.out | 119 +++ .../parallel_query/BABEL-328-vu-verify.out | 176 ++++ .../expected/parallel_query/BABEL-3295.out | 171 ++++ .../parallel_query/BABEL-3513-vu-prepare.out | 97 ++ .../parallel_query/BABEL-3513-vu-verify.out | 104 ++ .../expected/parallel_query/BABEL-4281.out | 117 +++ .../parallel_query/TestSQLQueries.out | 839 ++++++++++++++++ .../parallel_query/babel_collection.out | 899 ++++++++++++++++++ .../parallel_query/binary-index-vu-verify.out | 156 +++ test/JDBC/input/BABEL-1444.sql | 1 + test/JDBC/input/BABEL-2514.sql | 1 + test/JDBC/input/BABEL-2843.sql | 1 + test/JDBC/input/BABEL-2844.sql | 1 + test/JDBC/input/BABEL-2902.mix | 2 +- test/JDBC/input/BABEL-2903.sql | 1 + test/JDBC/input/BABEL-2998.mix | 1 + test/JDBC/input/BABEL-3248.sql | 1 + test/JDBC/input/BABEL-328-vu-verify.sql | 1 + test/JDBC/input/BABEL-4281.sql | 1 + test/JDBC/input/binary-index-vu-verify.sql | 1 + test/JDBC/input/pg_hint_plan/BABEL-3295.sql | 1 + .../pg_hint_plan/BABEL-3513-vu-prepare.mix | 1 + .../pg_hint_plan/BABEL-3513-vu-verify.mix | 1 + test/JDBC/input/sqlBatch/TestSQLQueries.txt | 1 + test/JDBC/parallel_query_jdbc_schedule | 35 +- 34 files changed, 4768 insertions(+), 34 deletions(-) create mode 100644 test/JDBC/expected/parallel_query/BABEL-1444.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-2514.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-2843.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-2844.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-2902.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-2903.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-2998.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-3248.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-328-vu-verify.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-3295.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-3513-vu-verify.out create mode 100644 test/JDBC/expected/parallel_query/BABEL-4281.out create mode 100644 test/JDBC/expected/parallel_query/TestSQLQueries.out create mode 100644 test/JDBC/expected/parallel_query/babel_collection.out create mode 100644 test/JDBC/expected/parallel_query/binary-index-vu-verify.out diff --git a/contrib/babelfishpg_tsql/sql/test/babel_collation.sql b/contrib/babelfishpg_tsql/sql/test/babel_collation.sql index 0156a21fea..6444543fc5 100644 --- a/contrib/babelfishpg_tsql/sql/test/babel_collation.sql +++ b/contrib/babelfishpg_tsql/sql/test/babel_collation.sql @@ -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 diff --git a/test/JDBC/expected/BABEL-2902.out b/test/JDBC/expected/BABEL-2902.out index a3158f24ad..1a2209f926 100644 --- a/test/JDBC/expected/BABEL-2902.out +++ b/test/JDBC/expected/BABEL-2902.out @@ -1,4 +1,3 @@ - -- psql -- Test setup -- ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'multi-db'; diff --git a/test/JDBC/expected/parallel_query/BABEL-1444.out b/test/JDBC/expected/parallel_query/BABEL-1444.out new file mode 100644 index 0000000000..5572d36498 --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-1444.out @@ -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 diff --git a/test/JDBC/expected/parallel_query/BABEL-2514.out b/test/JDBC/expected/parallel_query/BABEL-2514.out new file mode 100644 index 0000000000..e742ffcde4 --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-2514.out @@ -0,0 +1,199 @@ +USE master; +go + +select 'value' = '1'; +go +~~START~~ +varchar +1 +~~END~~ + + +drop view if exists babel_2514_view; +go +create view babel_2514_view as ( + select (select 'value' = '1') +); +go +select * from babel_2514_view; +go +~~START~~ +varchar +1 +~~END~~ + +drop view if exists babel_2514_view; +go + +drop function if exists babel_2514_func; +go +create function babel_2514_func() + returns table as return + ( + select * from (select 'value' = '1') col1 + ) +go +select babel_2514_func(); +go +~~START~~ +varchar +1 +~~END~~ + +drop function if exists babel_2514_func; +go + +DECLARE babel_2514_cursor CURSOR FOR select * from (select 'value' = '1') col1; +OPEN babel_2514_cursor +FETCH NEXT FROM babel_2514_cursor; +close babel_2514_cursor; +deallocate babel_2514_cursor; +go +~~START~~ +varchar +1 +~~END~~ + + +declare @babel_2514_cursor cursor +set @babel_2514_cursor = CURSOR FOR select * from (select 'value' = '1') col1; +open @babel_2514_cursor; +fetch next from @babel_2514_cursor; +go +~~START~~ +varchar +1 +~~END~~ + + +select (select 'value' = '1'); +go +~~START~~ +varchar +1 +~~END~~ + + +select * from (select 'value' = '1') a; +go +~~START~~ +varchar +1 +~~END~~ + + +WITH babel_2514_cte (a) AS +( + select 'value' = '1' +) +SELECT * from babel_2514_cte; +go +~~START~~ +varchar +1 +~~END~~ + + +WITH XMLNAMESPACES ('uri' as ns1) +SELECT 'value' = '1' +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'WITH XMLNAMESPACES' is not currently supported in Babelfish)~~ + + +declare @string1 nvarchar(5); +SELECT 'v' = @String1; +go +~~START~~ +nvarchar + +~~END~~ + + +drop function if exists babel_2514_func_local_id_1; +go +create function babel_2514_func_local_id_1(@String NVARCHAR(4000)) +returns table as return +( + SELECT @string +); +go +select babel_2514_func_local_id_1('abc'); +go +~~START~~ +nvarchar +abc +~~END~~ + +drop function if exists babel_2514_func_local_id_1; +go + +drop function if exists babel_2514_func_local_id_2; +go +create function babel_2514_func_local_id_2(@String NVARCHAR(4000)) +returns table as return +( + SELECT 'value' = @String +); +go +select babel_2514_func_local_id_2('abc def'); +go +~~START~~ +nvarchar +abc def +~~END~~ + +drop function if exists babel_2514_func_local_id_2; +go + +drop function if exists babel_2514_complex_func; +go +CREATE FUNCTION babel_2514_complex_func +( + @String NVARCHAR(4000), + @Delimiter NCHAR(1) +) +RETURNS TABLE +AS +RETURN +( + WITH Split(stpos, endpos) AS + ( + SELECT 0 AS stpos, CHARINDEX(@Delimiter,@String) AS endpos + UNION ALL + SELECT endpos+1, CHARINDEX(@Delimiter,@String,endpos+1) + FROM Split + WHERE endpos > 0 + ) + SELECT 'Value' = SUBSTRING(@String, stpos, COALESCE(NULLIF(endpos, 0), LEN(@String) + 1) - stpos) + FROM Split +); +go +select babel_2514_complex_func('abc def', ' '); +go +~~START~~ +nvarchar +abc +def +~~END~~ + +drop function if exists babel_2514_complex_func; +go + +drop view if exists babel_2514_complex_view; +go +create view babel_2514_complex_view as ( + select (select a = 1) col1, * from (select b = 2 union all select b = 3) t +); +go +select * from babel_2514_complex_view; +go +~~START~~ +int#!#int +1#!#3 +1#!#2 +~~END~~ + +drop view if exists babel_2514_complex_view; +go diff --git a/test/JDBC/expected/parallel_query/BABEL-2843.out b/test/JDBC/expected/parallel_query/BABEL-2843.out new file mode 100644 index 0000000000..ca6c9f4f7e --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-2843.out @@ -0,0 +1,418 @@ +use master; +go +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go +~~START~~ +text +off +~~END~~ + + +set babelfish_statistics profile On; +go +create table babel_2843_t1 (a1 int, b1 int); +go +create table babel_2843_t2 (a2 int, b2 int); +go + +-- single statement +select 1; +go +~~START~~ +int +1 +~~END~~ + +~~START~~ +text +Query Text: select 1 +Gather (cost=0.00..0.01 rows=1 width=4) (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Result (cost=0.00..0.01 rows=1 width=4) (actual rows=1 loops=1) +~~END~~ + +select * from babel_2843_t1 where b1 = 1; +go +~~START~~ +int#!#int +~~END~~ + +~~START~~ +text +Query Text: select * from babel_2843_t1 where b1 = 1 +Gather (cost=0.00..19.11 rows=11 width=8) (actual rows=0 loops=1) + Workers Planned: 3 + Workers Launched: 3 + -> Parallel Seq Scan on babel_2843_t1 (cost=0.00..19.11 rows=4 width=8) (actual rows=0 loops=4) + Filter: (b1 = 1) +~~END~~ + + +-- XML +select set_config('babelfishpg_tsql.explain_format', 'xml', false); +go +~~START~~ +text +xml +~~END~~ + +~~START~~ +xml + select set_config('babelfishpg_tsql.explain_format', 'xml', false) Result false false 0.00 0.01 1 32 1 1 +~~END~~ + +select * from babel_2843_t1 where b1 = 1; +go +~~START~~ +int#!#int +~~END~~ + +~~START~~ +xml + select * from babel_2843_t1 where b1 = 1 Gather false false 0.00 19.11 11 8 0 1 3 3 false Seq Scan Outer true false babel_2843_t1 babel_2843_t1 0.00 19.11 4 8 0 4 (b1 = 1) 0 +~~END~~ + + +-- JSON +select set_config('babelfishpg_tsql.explain_format', 'json', false); +go +~~START~~ +text +json +~~END~~ + +~~START~~ +text +{ "Query Text": "select set_config('babelfishpg_tsql.explain_format', 'json', false)", "Plan": { "Node Type": "Result", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.00, "Total Cost": 0.01, "Plan Rows": 1, "Plan Width": 32, "Actual Rows": 1, "Actual Loops": 1 }, "Triggers": [ ]} +~~END~~ + +select * from babel_2843_t1 where b1 = 1; +go +~~START~~ +int#!#int +~~END~~ + +~~START~~ +text +{ "Query Text": "select * from babel_2843_t1 where b1 = 1", "Plan": { "Node Type": "Gather", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.00, "Total Cost": 19.11, "Plan Rows": 11, "Plan Width": 8, "Actual Rows": 0, "Actual Loops": 1, "Workers Planned": 3, "Workers Launched": 3, "Single Copy": false, "Plans": [ { "Node Type": "Seq Scan", "Parent Relationship": "Outer", "Parallel Aware": true, "Async Capable": false, "Relation Name": "babel_2843_t1", "Alias": "babel_2843_t1", "Startup Cost": 0.00, "Total Cost": 19.11, "Plan Rows": 4, "Plan Width": 8, "Actual Rows": 0, "Actual Loops": 4, "Filter": "(b1 = 1)", "Rows Removed by Filter": 0, "Workers": [ ] } ] }, "Triggers": [ ]} +~~END~~ + + +-- YAML +select set_config('babelfishpg_tsql.explain_format', 'yaml', false); +go +~~START~~ +text +yaml +~~END~~ + +~~START~~ +text +Query Text: "select set_config('babelfishpg_tsql.explain_format', 'yaml', false)"Plan: Node Type: "Result" Parallel Aware: false Async Capable: false Startup Cost: 0.00 Total Cost: 0.01 Plan Rows: 1 Plan Width: 32 Actual Rows: 1 Actual Loops: 1Triggers: +~~END~~ + +select * from babel_2843_t1 where b1 = 1; +go +~~START~~ +int#!#int +~~END~~ + +~~START~~ +text +Query Text: "select * from babel_2843_t1 where b1 = 1"Plan: Node Type: "Gather" Parallel Aware: false Async Capable: false Startup Cost: 0.00 Total Cost: 19.11 Plan Rows: 11 Plan Width: 8 Actual Rows: 0 Actual Loops: 1 Workers Planned: 3 Workers Launched: 3 Single Copy: false Plans: - Node Type: "Seq Scan" Parent Relationship: "Outer" Parallel Aware: true Async Capable: false Relation Name: "babel_2843_t1" Alias: "babel_2843_t1" Startup Cost: 0.00 Total Cost: 19.11 Plan Rows: 4 Plan Width: 8 Actual Rows: 0 Actual Loops: 4 Filter: "(b1 = 1)" Rows Removed by Filter: 0 Workers: Triggers: +~~END~~ + + +select set_config('babelfishpg_tsql.explain_format', 'text', false); +go +~~START~~ +text +text +~~END~~ + +~~START~~ +text +Query Text: select set_config('babelfishpg_tsql.explain_format', 'text', false) +Result (cost=0.00..0.01 rows=1 width=32) (actual rows=1 loops=1) +~~END~~ + + +-- multiple statements +insert babel_2843_t1 values (1, 1); +insert babel_2843_t1 values (2, 2); +insert into babel_2843_t2 select * from babel_2843_t1 where a1 = 1; +select * from babel_2843_t1; +select * from babel_2843_t2; +go +~~ROW COUNT: 1~~ + +~~START~~ +text +Query Text: insert babel_2843_t1 values (1, 1); +Insert on babel_2843_t1 (cost=0.00..0.01 rows=0 width=0) (actual rows=0 loops=1) + -> Result (cost=0.00..0.01 rows=1 width=8) (actual rows=1 loops=1) +~~END~~ + +~~ROW COUNT: 1~~ + +~~START~~ +text +Query Text: insert babel_2843_t1 values (2, 2); +Insert on babel_2843_t1 (cost=0.00..0.01 rows=0 width=0) (actual rows=0 loops=1) + -> Result (cost=0.00..0.01 rows=1 width=8) (actual rows=1 loops=1) +~~END~~ + +~~ROW COUNT: 1~~ + +~~START~~ +text +Query Text: insert into babel_2843_t2 select * from babel_2843_t1 where a1 = 1; +Insert on babel_2843_t2 (cost=0.00..38.25 rows=0 width=0) (actual rows=0 loops=1) + -> Seq Scan on babel_2843_t1 (cost=0.00..38.25 rows=11 width=8) (actual rows=1 loops=1) + Filter: (a1 = 1) + Rows Removed by Filter: 1 +~~END~~ + +~~START~~ +int#!#int +1#!#1 +2#!#2 +~~END~~ + +~~START~~ +text +Query Text: select * from babel_2843_t1 +Gather (cost=0.00..17.29 rows=2260 width=8) (actual rows=2 loops=1) + Workers Planned: 3 + Workers Launched: 3 + -> Parallel Seq Scan on babel_2843_t1 (cost=0.00..17.29 rows=729 width=8) (actual rows=0 loops=4) +~~END~~ + +~~START~~ +int#!#int +1#!#1 +~~END~~ + +~~START~~ +text +Query Text: select * from babel_2843_t2 +Gather (cost=0.00..17.29 rows=2260 width=8) (actual rows=1 loops=1) + Workers Planned: 3 + Workers Launched: 3 + -> Parallel Seq Scan on babel_2843_t2 (cost=0.00..17.29 rows=729 width=8) (actual rows=0 loops=4) +~~END~~ + + +-- procedure +create procedure babel_2843_proc @param int +as + insert babel_2843_t1 values (3, 3); + select * from babel_2843_t1 where a1 = @param; +go +execute babel_2843_proc 1; +go +~~ROW COUNT: 1~~ + +~~START~~ +int#!#int +1#!#1 +~~END~~ + +~~START~~ +text +Query Text: insert babel_2843_t1 values (3, 3); +Insert on babel_2843_t1 (cost=0.00..0.01 rows=0 width=0) (actual rows=0 loops=1) + -> Result (cost=0.00..0.01 rows=1 width=8) (actual rows=1 loops=1) +~~END~~ + +~~START~~ +text +Query Text: select * from babel_2843_t1 where a1 = "@param" +Gather (cost=0.00..19.11 rows=11 width=8) (actual rows=1 loops=1) + Workers Planned: 3 + Workers Launched: 3 + -> Parallel Seq Scan on babel_2843_t1 (cost=0.00..19.11 rows=4 width=8) (actual rows=0 loops=4) + Filter: (a1 = 1) + Rows Removed by Filter: 0 +~~END~~ + +drop procedure babel_2843_proc; +go + +-- ITVF (Inline Table-Valued Function) +create function babel_2843_itvf(@param int) +returns table + as return ( + select * from babel_2843_t1 where a1 = @param + ); +go +select * from babel_2843_itvf(2); +go +~~START~~ +int#!#int +2#!#2 +~~END~~ + +~~START~~ +text +Query Text: select * from babel_2843_t1 where a1 = @param +Seq Scan on babel_2843_t1 (cost=0.00..38.25 rows=11 width=8) (actual rows=1 loops=1) + Filter: (a1 = 2) + Rows Removed by Filter: 2 +~~END~~ + +~~START~~ +text +Query Text: select * from babel_2843_itvf(2) +Function Scan on babel_2843_itvf (cost=0.25..10.25 rows=1000 width=8) (actual rows=1 loops=1) +~~END~~ + +drop function babel_2843_itvf; +go + +-- MSTVF (Multi-Statement Table-Valued Function) +create function babel_2843_mstvf(@param int) +returns @tab table (a int, b int) +as begin + insert into @tab select * from babel_2843_t1 where a1 = @param; + insert into @tab select * from babel_2843_t2 where a2 = @param; + return; +end; +go +select * from babel_2843_mstvf(1); +go +~~START~~ +int#!#int +1#!#1 +1#!#1 +~~END~~ + +~~START~~ +text +Query Text: SELECT @@nestlevel +Result (cost=0.00..0.26 rows=1 width=4) (actual rows=1 loops=1) +~~END~~ + +~~START~~ +text +Query Text: insert into "@tab" select * from babel_2843_t1 where a1 = "@param"; +Insert on "@tab_1" (cost=0.00..38.25 rows=0 width=0) (actual rows=0 loops=1) + -> Seq Scan on babel_2843_t1 (cost=0.00..38.25 rows=11 width=8) (actual rows=1 loops=1) + Filter: (a1 = 1) + Rows Removed by Filter: 2 +~~END~~ + +~~START~~ +text +Query Text: insert into "@tab" select * from babel_2843_t2 where a2 = "@param"; +Insert on "@tab_1" (cost=0.00..38.25 rows=0 width=0) (actual rows=0 loops=1) + -> Seq Scan on babel_2843_t2 (cost=0.00..38.25 rows=11 width=8) (actual rows=1 loops=1) + Filter: (a2 = 1) +~~END~~ + +~~START~~ +text +Query Text: select * from @tab_1 +Seq Scan on "@tab_1" (cost=0.00..32.60 rows=2260 width=8) (actual rows=2 loops=1) +~~END~~ + +~~START~~ +text +Query Text: select * from babel_2843_mstvf(1) +Function Scan on babel_2843_mstvf (cost=0.25..10.25 rows=1000 width=8) (actual rows=2 loops=1) +~~END~~ + +drop function babel_2843_mstvf; +go + +-- Control structure +declare @val int = (select a1 from babel_2843_t1 where b1 = 1); +if @val = 1 + select 1 +else + select 2 +; +go +~~START~~ +text +Query Text: SELECT (select a1 from babel_2843_t1 where b1 = 1) +Result (cost=38.25..38.26 rows=1 width=4) (actual rows=1 loops=1) + InitPlan 1 (returns $0) + -> Seq Scan on babel_2843_t1 (cost=0.00..38.25 rows=11 width=4) (actual rows=1 loops=1) + Filter: (b1 = 1) + Rows Removed by Filter: 2 +~~END~~ + +~~START~~ +int +1 +~~END~~ + +~~START~~ +text +Query Text: select 1 +Gather (cost=0.00..0.01 rows=1 width=4) (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Result (cost=0.00..0.01 rows=1 width=4) (actual rows=1 loops=1) +~~END~~ + + +-- execsql +DECLARE @val INT; +DECLARE @sql NVARCHAR(500); +DECLARE @paramdef NVARCHAR(500); +SET @sql = N'select * from babel_2843_t1 where a1 = @param'; +SET @paramdef = N'@param int'; +SET @val = 2; +EXECUTE sp_executesql @sql, @paramdef, + @param = @val; +go +~~START~~ +int#!#int +2#!#2 +~~END~~ + +~~START~~ +text +Query Text: select * from babel_2843_t1 where a1 = "@param" +Gather (cost=0.00..19.11 rows=11 width=8) (actual rows=1 loops=1) + Workers Planned: 3 + Workers Launched: 3 + -> Parallel Seq Scan on babel_2843_t1 (cost=0.00..19.11 rows=4 width=8) (actual rows=0 loops=4) + Filter: (a1 = 2) + Rows Removed by Filter: 0 +~~END~~ + + +drop table babel_2843_t1; +go +drop table babel_2843_t2; +go +set babelfish_statistics profile oFf; +go + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go +~~START~~ +text +on +~~END~~ + diff --git a/test/JDBC/expected/parallel_query/BABEL-2844.out b/test/JDBC/expected/parallel_query/BABEL-2844.out new file mode 100644 index 0000000000..370e172e73 --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-2844.out @@ -0,0 +1,392 @@ +use master; +go + +select current_setting('babelfishpg_tsql.explain_costs'); +go +~~START~~ +text +on +~~END~~ + + +-- CREATE TABLE should not be executed +set BABELFISH_SHOWPLAN_ALL oN; +go +create table babel_2844_t1 (a1 int, b1 int); +go +~~START~~ +text +Query Text: create table babel_2844_t1 (a1 int, b1 int); +~~END~~ + +select * from babel_2844_t1 where b1 = 1; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "babel_2844_t1" does not exist)~~ + + +-- SELECT should not be executed +select * from set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +~~START~~ +text +Query Text: select * from set_config('babelfishpg_tsql.explain_costs', 'off', false) +Function Scan on set_config (cost=0.00..0.01 rows=1 width=32) +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go +select current_setting('babelfishpg_tsql.explain_costs'); +go +~~START~~ +text +on +~~END~~ + + +-- Create tables +create table babel_2844_t1 (a1 int, b1 int); +go +insert babel_2844_t1 values (1, 1); +go +~~ROW COUNT: 1~~ + +create table babel_2844_t2 (a2 int, b2 int); +go + +-- INSERT should not be executed +set BABELFISH_SHOWPLAN_ALL ON; +go +insert babel_2844_t1 values (2, 2); +go +~~START~~ +text +Query Text: insert babel_2844_t1 values (2, 2); +Insert on babel_2844_t1 (cost=0.00..0.01 rows=0 width=0) + -> Result (cost=0.00..0.01 rows=1 width=8) +~~END~~ + +insert into babel_2844_t2 select * from babel_2844_t1 where a1 = 1; +go +~~START~~ +text +Query Text: insert into babel_2844_t2 select * from babel_2844_t1 where a1 = 1; +Insert on babel_2844_t2 (cost=0.00..38.25 rows=0 width=0) + -> Seq Scan on babel_2844_t1 (cost=0.00..38.25 rows=11 width=8) + Filter: (a1 = 1) +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go +select * from babel_2844_t1; +go +~~START~~ +int#!#int +1#!#1 +~~END~~ + +select * from babel_2844_t2; +go +~~START~~ +int#!#int +~~END~~ + + +-- single statement +set BABELFISH_SHOWPLAN_ALL ON; +go +select 1; +go +~~START~~ +text +Query Text: select 1 +Gather (cost=0.00..0.01 rows=1 width=4) + Workers Planned: 1 + Single Copy: true + -> Result (cost=0.00..0.01 rows=1 width=4) +~~END~~ + +select * from babel_2844_t1 where b1 = 1; +go +~~START~~ +text +Query Text: select * from babel_2844_t1 where b1 = 1 +Gather (cost=0.00..19.11 rows=11 width=8) + Workers Planned: 3 + -> Parallel Seq Scan on babel_2844_t1 (cost=0.00..19.11 rows=4 width=8) + Filter: (b1 = 1) +~~END~~ + + +-- Other formats +set BABELFISH_SHOWPLAN_ALL OFF; +go +select set_config('babelfishpg_tsql.explain_format', 'xml', false); +go +~~START~~ +text +xml +~~END~~ + +set BABELFISH_SHOWPLAN_ALL ON; +go +select * from babel_2844_t1 where b1 = 1; +go +~~START~~ +text +Query Text: select * from babel_2844_t1 where b1 = 1 +Gather (cost=0.00..19.11 rows=11 width=8) + Workers Planned: 3 + -> Parallel Seq Scan on babel_2844_t1 (cost=0.00..19.11 rows=4 width=8) + Filter: (b1 = 1) +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go +select set_config('babelfishpg_tsql.explain_format', 'json', false); +go +~~START~~ +text +json +~~END~~ + +set BABELFISH_SHOWPLAN_ALL ON; +go +select * from babel_2844_t1 where b1 = 1; +go +~~START~~ +text +Query Text: select * from babel_2844_t1 where b1 = 1 +Gather (cost=0.00..19.11 rows=11 width=8) + Workers Planned: 3 + -> Parallel Seq Scan on babel_2844_t1 (cost=0.00..19.11 rows=4 width=8) + Filter: (b1 = 1) +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go +select set_config('babelfishpg_tsql.explain_format', 'yaml', false); +go +~~START~~ +text +yaml +~~END~~ + +set BABELFISH_SHOWPLAN_ALL ON; +select * from babel_2844_t1 where b1 = 1; +go +~~START~~ +text +Query Text: select * from babel_2844_t1 where b1 = 1 +Gather (cost=0.00..19.11 rows=11 width=8) + Workers Planned: 3 + -> Parallel Seq Scan on babel_2844_t1 (cost=0.00..19.11 rows=4 width=8) + Filter: (b1 = 1) +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go +select set_config('babelfishpg_tsql.explain_format', 'text', false); +go +~~START~~ +text +text +~~END~~ + + +-- multiple statements +set BABELFISH_SHOWPLAN_ALL ON; +insert babel_2844_t1 values (2, 2); +insert into babel_2844_t2 select * from babel_2844_t1 where a1 in (1, 2); +select * from babel_2844_t1; +select * from babel_2844_t2; +go +~~START~~ +text +Query Text: insert babel_2844_t1 values (2, 2); +Insert on babel_2844_t1 (cost=0.00..0.01 rows=0 width=0) + -> Result (cost=0.00..0.01 rows=1 width=8) +Query Text: insert into babel_2844_t2 select * from babel_2844_t1 where a1 in (1, 2); +Insert on babel_2844_t2 (cost=0.00..38.25 rows=0 width=0) + -> Seq Scan on babel_2844_t1 (cost=0.00..38.25 rows=23 width=8) + Filter: (a1 = ANY ('{1,2}'::integer[])) +Query Text: select * from babel_2844_t1 +Gather (cost=0.00..17.29 rows=2260 width=8) + Workers Planned: 3 + -> Parallel Seq Scan on babel_2844_t1 (cost=0.00..17.29 rows=729 width=8) +Query Text: select * from babel_2844_t2 +Gather (cost=0.00..17.29 rows=2260 width=8) + Workers Planned: 3 + -> Parallel Seq Scan on babel_2844_t2 (cost=0.00..17.29 rows=729 width=8) +~~END~~ + + +set BABELFISH_SHOWPLAN_ALL OFF; +go +select * from babel_2844_t1; +go +~~START~~ +int#!#int +1#!#1 +~~END~~ + +select * from babel_2844_t2; +go +~~START~~ +int#!#int +~~END~~ + + +-- pltsql procedure +create procedure babel_2844_proc @param int +as + insert babel_2844_t1 values (3, 3); + select * from babel_2844_t1 where a1 = @param; +go +set BABELFISH_SHOWPLAN_ALL ON; +go +execute babel_2844_proc 3; +go +~~START~~ +text +Query Text: EXEC babel_2844_proc 3 + Query Text: insert babel_2844_t1 values (3, 3); + -> Insert on babel_2844_t1 (cost=0.00..0.01 rows=0 width=0) + -> Result (cost=0.00..0.01 rows=1 width=8) + Query Text: select * from babel_2844_t1 where a1 = "@param" + -> Gather (cost=0.00..19.11 rows=11 width=8) + Workers Planned: 3 + -> Parallel Seq Scan on babel_2844_t1 (cost=0.00..19.11 rows=4 width=8) + Filter: (a1 = 3) +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go +select * from babel_2844_t1; +go +~~START~~ +int#!#int +1#!#1 +~~END~~ + +drop procedure babel_2844_proc; +go + +-- C procedure +set BABELFISH_SHOWPLAN_ALL ON; +go +declare @handle int; +EXEC SP_PREPARE @handle OUT, NULL, 'select * from babel_2844_t1'; +go +~~START~~ +text +Query Text: EXEC SP_PREPARE @handle OUT, NULL, 'select * from babel_2844_t1' +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go + +-- ITVF (Inline Table-Valued Function) +create function babel_2844_itvf(@param int) +returns table + as return ( + select * from babel_2844_t1 where a1 = @param + ); +go +set BABELFISH_SHOWPLAN_ALL ON; +go +select * from babel_2844_itvf(1); +go +~~START~~ +text +Query Text: select * from babel_2844_itvf(1) +Function Scan on babel_2844_itvf (cost=0.25..10.25 rows=1000 width=8) +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go +drop function babel_2844_itvf; +go + +-- MSTVF (Multi-Statement Table-Valued Function) +create function babel_2844_mstvf(@param int) +returns @tab table (a int, b int) +as begin + insert into @tab select * from babel_2844_t1 where a1 = @param; + insert into @tab select * from babel_2844_t2 where a2 = @param; + return; +end; +go +set BABELFISH_SHOWPLAN_ALL ON; +go +select * from babel_2844_mstvf(1); +go +~~START~~ +text +Query Text: select * from babel_2844_mstvf(1) +Function Scan on babel_2844_mstvf (cost=0.25..10.25 rows=1000 width=8) +~~END~~ + +set BABELFISH_SHOWPLAN_ALL OFF; +go +drop function babel_2844_mstvf; +go + +-- Control structure +set BABELFISH_SHOWPLAN_ALL ON; +go +if (select a1 from babel_2844_t1 where b1 = 1) = 1 + select 1 +else + select 2 +; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Showing Estimated Execution Plan for CONDITIONAL GOTO statement is not yet supported)~~ + + +-- sp_executesql +EXECUTE sp_executesql N'select * from babel_2844_t1 where a1 = @param', N'@param int', + @param = 2; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Showing Estimated Execution Plan for EXEC SP statment is not yet supported)~~ + + +-- Temp tables +create table #babel_2844_tt1 (a int, b int); +select * from #babel_2844_tt1 where a = 1; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "#babel_2844_tt1" does not exist)~~ + + +-- SET EXPLAIN ANALYZE +set BABELFISH_STATISTICS PROFILE ON; +go +~~START~~ +text +Query Text: set BABELFISH_STATISTICS PROFILE ON; +~~END~~ + + +set BABELFISH_SHOWPLAN_ALL OfF; +go + +-- Should not return a query plan +select * from babel_2844_t1; +go +~~START~~ +int#!#int +1#!#1 +~~END~~ + + +drop table babel_2844_t1; +go +drop table babel_2844_t2; +go diff --git a/test/JDBC/expected/parallel_query/BABEL-2902.out b/test/JDBC/expected/parallel_query/BABEL-2902.out new file mode 100644 index 0000000000..c04a5d15f2 --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-2902.out @@ -0,0 +1,587 @@ +-- psql +-- Test setup -- +ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'multi-db'; +SELECT pg_reload_conf(); +GO +~~START~~ +bool +t +~~END~~ + + +-- tsql +USE master +GO + +-- Drop tables and databases if exist +DROP TABLE IF EXISTS babel_2902_ma1 +DROP DATABASE IF EXISTS babel_2902_testdb_1 +DROP DATABASE IF EXISTS babel_2902_testdb_2 +DROP DATABASE IF EXISTS babel_2902_testdb_3 +GO + + +--Create tables and databases for testing +CREATE TABLE babel_2902_ma1 (a int) +GO + +CREATE DATABASE babel_2902_testdb_1 +GO + +USE babel_2902_testdb_1 +CREATE TABLE babel_2902_t1 (z int) +GO + +CREATE DATABASE babel_2902_testdb_2 +GO + +USE babel_2902_testdb_2 +CREATE TABLE babel_2902_t2 (z int) +GO + +CREATE DATABASE babel_2902_testdb_3 +GO + +USE babel_2902_testdb_3 +CREATE TABLE babel_2902_t3 (z int) +GO + +USE master +GO + +SELECT set_config('babelfishpg_tsql.explain_costs', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +SET babelfish_showplan_all on +GO + +-- Test cases for print -- +--Basic +PRINT 'hi' +GO +~~START~~ +text +Query Text: PRINT 'hi' +~~END~~ + +PRINT 10 +GO +~~START~~ +text +Query Text: PRINT 10 +~~END~~ + +PRINT 12.023 +GO +~~START~~ +text +Query Text: PRINT 12.023 +~~END~~ + + +--Function +PRINT pg_backend_pid() +GO +~~START~~ +text +Query Text: PRINT pg_backend_pid() +~~END~~ + + +--Expression +PRINT 20 + 20 +GO +~~START~~ +text +Query Text: PRINT 20 + 20 +~~END~~ + + +-- Variables +DECLARE @a INT +SET @a = 100 +PRINT @a +GO +~~START~~ +text +Query Text: ASSIGN @a = SELECT 100 + Query Text: SELECT 100 + -> Result +Query Text: PRINT @a +~~END~~ + + +-- Exceptions +PRINT 1/0 +GO +~~START~~ +text +Query Text: PRINT 1/0 +~~END~~ + + +--In combination with other statements +BEGIN + DECLARE @a INT + SET @a = 0 + SELECT COUNT(*) FROM babel_2902_ma1 + PRINT 'The value of a is ' + CONVERT(VARCHAR, @a) + SET @a = @a + 1 +END +GO +~~START~~ +text +Query Text: ASSIGN @a = SELECT 0 + Query Text: SELECT 0 + -> Result +Query Text: SELECT COUNT(*) FROM babel_2902_ma1 +Finalize Aggregate + -> Gather + Workers Planned: 3 + -> Partial Aggregate + -> Parallel Seq Scan on babel_2902_ma1 +Query Text: PRINT 'The value of a is ' + CONVERT(VARCHAR, @a) +Query Text: ASSIGN @a = SELECT @a + 1 + Query Text: SELECT @a + 1 + -> Result +~~END~~ + + +--Invalid statements +PRINT SELECT 1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'SELECT' at line 2 and character position 6)~~ + + +---- Test cases for USE DB ---- +--Happy path +SELECT * FROM babel_2902_ma1 +USE babel_2902_testdb_1 +SELECT * FROM babel_2902_t1 +GO +~~START~~ +text +Query Text: SELECT * FROM babel_2902_ma1 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_ma1 +Query Text: USE DATABASE babel_2902_testdb_1 +Query Text: SELECT * FROM babel_2902_t1 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_t1 +~~END~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() --should be master +GO +~~START~~ +nvarchar +master +~~END~~ + + +--Test statements before USE DB +SET babelfish_showplan_all on +GO +PRINT 'testing' +SELECT COUNT(*) FROM babel_2902_ma1 +USE babel_2902_testdb_3 +SELECT * FROM babel_2902_t3 +GO +~~START~~ +text +Query Text: PRINT 'testing' +Query Text: SELECT COUNT(*) FROM babel_2902_ma1 +Finalize Aggregate + -> Gather + Workers Planned: 3 + -> Partial Aggregate + -> Parallel Seq Scan on babel_2902_ma1 +Query Text: USE DATABASE babel_2902_testdb_3 +Query Text: SELECT * FROM babel_2902_t3 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_t3 +~~END~~ + +SET babelfish_showplan_all off +GO +SELECT DB_NAME() --should be master +GO +~~START~~ +nvarchar +master +~~END~~ + + +--test multiple switches +SET babelfish_showplan_all on +GO +USE babel_2902_testdb_1 +SELECT * FROM babel_2902_t1 +SELECT * FROM babel_2902_t1 +SELECT * FROM babel_2902_t1 +USE babel_2902_testdb_2 +SELECT * FROM babel_2902_t2 +SELECT * FROM babel_2902_t2 +USE babel_2902_testdb_3 +SELECT * FROM babel_2902_t3 +USE babel_2902_testdb_2 +GO +~~START~~ +text +Query Text: USE DATABASE babel_2902_testdb_1 +Query Text: SELECT * FROM babel_2902_t1 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_t1 +Query Text: SELECT * FROM babel_2902_t1 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_t1 +Query Text: SELECT * FROM babel_2902_t1 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_t1 +Query Text: USE DATABASE babel_2902_testdb_2 +Query Text: SELECT * FROM babel_2902_t2 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_t2 +Query Text: SELECT * FROM babel_2902_t2 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_t2 +Query Text: USE DATABASE babel_2902_testdb_3 +Query Text: SELECT * FROM babel_2902_t3 +Gather + Workers Planned: 3 + -> Parallel Seq Scan on babel_2902_t3 +Query Text: USE DATABASE babel_2902_testdb_2 +~~END~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() -- should still be master +GO +~~START~~ +nvarchar +master +~~END~~ + + +--test multiple switches between two databases +SET babelfish_showplan_all on +GO +USE babel_2902_testdb_1 +USE master +USE babel_2902_testdb_1 +USE master +USE babel_2902_testdb_1 +USE master +USE babel_2902_testdb_1 +GO +~~START~~ +text +Query Text: USE DATABASE babel_2902_testdb_1 +Query Text: USE DATABASE master +Query Text: USE DATABASE babel_2902_testdb_1 +Query Text: USE DATABASE master +Query Text: USE DATABASE babel_2902_testdb_1 +Query Text: USE DATABASE master +Query Text: USE DATABASE babel_2902_testdb_1 +~~END~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() -- should still be master +GO +~~START~~ +nvarchar +master +~~END~~ + + +--test returning to a database other than master +USE babel_2902_testdb_1 +GO + +SET babelfish_showplan_all on +GO +USE master +GO +~~START~~ +text +Query Text: USE DATABASE master +~~END~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() -- should still be babel_2902_testdb_1 +GO +~~START~~ +nvarchar +babel_2902_testdb_1 +~~END~~ + + +SET babelfish_showplan_all on +GO +PRINT 10 +USE master +USE babel_2902_testdb_2 +GO +~~START~~ +text +Query Text: PRINT 10 +Query Text: USE DATABASE master +Query Text: USE DATABASE babel_2902_testdb_2 +~~END~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() -- should still be babel_2902_testdb_1 +GO +~~START~~ +nvarchar +babel_2902_testdb_1 +~~END~~ + + + +USE master +--Test invalid statements +SET babelfish_showplan_all on +GO +USE babel_2902_testdb_1 +SELECT * FROM babel_2902_ma1 --table only exists in master db +PRINT 10 -- shouldn't execute +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "babel_2902_ma1" does not exist)~~ + + +SET babelfish_showplan_all off +SELECT DB_NAME() --should be master +SET babelfish_showplan_all on +GO +~~START~~ +nvarchar +babel_2902_testdb_1 +~~END~~ + +USE babel_2902_testdb_1 +SELECT * FROM babel_2902_t1 +USE NOT_A_REAL_DATABASE +GO +~~ERROR (Code: 911)~~ + +~~ERROR (Message: database "not_a_real_database" does not exist)~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() --should be master +GO +~~START~~ +nvarchar +babel_2902_testdb_1 +~~END~~ + + +SET babelfish_showplan_all on +GO +USE babel_2902_testdb_1 +USE master +USE babel_2902_testdb_2 +USE babel_2902_testdb_1 +USE babel_2902_testdb_3 +USE NOT_A_REAL_DATABASE +USE babel_2902_testdb_1 --should not be reached +GO +~~ERROR (Code: 911)~~ + +~~ERROR (Message: database "not_a_real_database" does not exist)~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() --should be master +GO +~~START~~ +nvarchar +babel_2902_testdb_1 +~~END~~ + + +-- Invalid syntax +SET babelfish_showplan_all on +GO +PRINT 'test' +USE babel_2902_testdb_1 +USE master +USE babel_2902_testdb_2 +SELECT FROM WHERE +USE babel_2902_testdb_3 --should not be reached +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'FROM' at line 5 and character position 7)~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() --should be master +GO +~~START~~ +nvarchar +babel_2902_testdb_1 +~~END~~ + + +SET babelfish_showplan_all on +GO +USE babel_2902_testdb_1 +PRINT 'test' +PRINT 'test' +USE master +USE babel_2902_testdb_2 +PRINT 'test' +PRINT 'test' +SELECT FROM WHERE +USE babel_2902_testdb_3 --should not be reached +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'FROM' at line 8 and character position 7)~~ + +SET babelfish_showplan_all off +SELECT DB_NAME() --should be master +GO +~~START~~ +nvarchar +babel_2902_testdb_1 +~~END~~ + + + +---- TEST RAISEERROR ---- +-- note that during explain TSQL does very limited no validation on inputs to raiserror +-- This means that normally invalid cases such as using error code that are too low, too high +-- or are non existant do not result in an error. Similarly, things like argument counts are +-- not validated, nor are variables checked for existance, so long as it is syntactically correct +-- explain will accept the raiserror statements +SET babelfish_showplan_all ON +GO +--happy path-- +RAISERROR (N'TEST %s %d.',1,1,N'testing',9); +GO +~~START~~ +text +Query Text: RAISERROR (N'TEST %s %d.',1,1,N'testing',9) +~~END~~ + +--system error message, note message code validation is NOT done during explain-- +RAISERROR (10000,1,1,N'testing',9); +GO +~~START~~ +text +Query Text: RAISERROR (10000,1,1,N'testing',9) +~~END~~ + +--variables, note that variable substitution is NOT done during explain -- +DECLARE @testMsg VARCHAR(100) +SET @testMsg = 'a: %s b: %s c :%s' +RAISERROR (@testMsg, 1, 1, 'a', 'b', 'c') +GO +~~START~~ +text +Query Text: ASSIGN @testmsg = SELECT 'a: %s b: %s c :%s' + Query Text: SELECT 'a: %s b: %s c :%s' + -> Result +Query Text: RAISERROR (@testMsg,1,1,'a','b','c') +~~END~~ + + +-- TEST THROW -- +-- Throw is similar to RAISERROR in that during explain it is lax in enforcement of validation +-- However it does validate two cases in particular. First if it is invoked without parameters +-- you must be inside a catch block. arguments must be of the correct types +--happy path-- +THROW 51000, 'test', 1 +GO +~~START~~ +text +Query Text: THROW 51000, 'test', 1 +~~END~~ + +-- invalid argument types -- +THROW 'a', 'test', 1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: procedure throw(unknown, unknown, integer) does not exist)~~ + +THROW 51000, 1, 1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: procedure throw(integer, integer, integer) does not exist)~~ + +THROW 51000, 1, 'test' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: procedure throw(integer, integer, unknown) does not exist)~~ + + +-- try catch -- +THROW +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: THROW without parameters should be executed inside a CATCH block)~~ + + +-- Unable to test until explain for RESTORE CTX PARTIAL is implemented +BEGIN TRY + SELECT 1/0 +END TRY +BEGIN CATCH + PRINT 'test' + THROW +END CATCH +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Showing Estimated Execution Plan for RESTORE CTX PARTIAL statment is not yet supported)~~ + + +-- Clean up -- +SET babelfish_showplan_all OFF +GO +USE babel_2902_testdb_1 +DROP TABLE babel_2902_t1 +GO +USE babel_2902_testdb_2 +DROP TABLE babel_2902_t2 +GO +USE babel_2902_testdb_3 +DROP TABLE babel_2902_t3 +GO +USE MASTER +GO +DROP TABLE IF EXISTS babel_2902_ma1 +GO +DROP DATABASE IF EXISTS babel_2902_testdb_1 +DROP DATABASE IF EXISTS babel_2902_testdb_2 +DROP DATABASE IF EXISTS babel_2902_testdb_3 +GO +-- psql +ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'single-db'; +SELECT pg_reload_conf(); +GO +~~START~~ +bool +t +~~END~~ + diff --git a/test/JDBC/expected/parallel_query/BABEL-2903.out b/test/JDBC/expected/parallel_query/BABEL-2903.out new file mode 100644 index 0000000000..44c9c02f5b --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-2903.out @@ -0,0 +1,113 @@ +use master; +go + +drop table if exists babel_2903_t1; +go +create table babel_2903_t1 (a int, b int); +go +insert into babel_2903_t1 values (1, 1); +go +~~ROW COUNT: 1~~ + +insert into babel_2903_t1 values (2, 2); +go +~~ROW COUNT: 1~~ + +select * from babel_2903_t1; +go +~~START~~ +int#!#int +1#!#1 +2#!#2 +~~END~~ + + +drop procedure if exists babel_2903_inner_proc; +go +create procedure babel_2903_inner_proc @b int +as + set @b = (select top 1 a+b from babel_2903_t1 order by b); + insert into babel_2903_t1 values (@b, @b); +go + +drop procedure if exists babel_2903_outer_proc; +go +create procedure babel_2903_outer_proc @a int, @b int +as + declare @t table (a int, b int); + set @a = 3; + insert into babel_2903_t1 values (@a, @b); + exec babel_2903_inner_proc @b; + insert into @t select * from babel_2903_t1; + select * from @t; +go + +set BABELFISH_SHOWPLAN_ALL ON; +go + +declare @a int = 5, @b int = 5; +declare @c int; +execute babel_2903_outer_proc @a, @b; +select @a, @b; +go +~~START~~ +text +Query Text: ASSIGN @a = SELECT 5 + Query Text: SELECT 5 + -> Result (cost=0.00..0.01 rows=1 width=4) +Query Text: ASSIGN @b = SELECT 5 + Query Text: SELECT 5 + -> Result (cost=0.00..0.01 rows=1 width=4) +Query Text: EXEC babel_2903_outer_proc @a, @b + Query Text: DECLARE TABLE @t + Query Text: CREATE TEMPORARY TABLE IF NOT EXISTS @t_1 (a int, b int) + Query Text: ASSIGN @a = SELECT 3 + Query Text: SELECT 3 + -> Result (cost=0.00..0.01 rows=1 width=4) + Query Text: insert into babel_2903_t1 values ("@a", "@b"); + -> Insert on babel_2903_t1 (cost=0.00..0.01 rows=0 width=0) + -> Result (cost=0.00..0.01 rows=1 width=8) + Query Text: EXEC babel_2903_inner_proc @b + Query Text: ASSIGN @b = SELECT (select top 1 a+b from babel_2903_t1 order by b) + Query Text: SELECT (select top 1 a+b from babel_2903_t1 order by b) + -> Result (cost=49.55..49.56 rows=1 width=4) + InitPlan 1 (returns $0) + -> Limit (cost=49.55..49.55 rows=1 width=8) + -> Sort (cost=49.55..55.20 rows=2260 width=8) + Sort Key: babel_2903_t1.b NULLS FIRST + -> Seq Scan on babel_2903_t1 (cost=0.00..38.25 rows=2260 width=8) + Query Text: insert into babel_2903_t1 values ("@b", "@b"); + -> Insert on babel_2903_t1 (cost=0.00..0.01 rows=0 width=0) + -> Result (cost=0.00..0.01 rows=1 width=8) + Query Text: insert into "@t" select * from babel_2903_t1; + -> Insert on "@t_1" (cost=0.00..32.60 rows=0 width=0) + -> Seq Scan on babel_2903_t1 (cost=0.00..32.60 rows=2260 width=8) + Query Text: select * from "@t" + -> Seq Scan on "@t_1" (cost=0.00..32.60 rows=2260 width=8) + Query Text: DROP TABLE @t_1 +Query Text: select "@a", "@b" +Gather (cost=0.00..0.01 rows=1 width=8) + Workers Planned: 1 + Single Copy: true + -> Result (cost=0.00..0.01 rows=1 width=8) +~~END~~ + + +set BABELFISH_SHOWPLAN_ALL Off; +go + +select * from babel_2903_t1; +go +~~START~~ +int#!#int +1#!#1 +2#!#2 +~~END~~ + + +drop procedure if exists babel_2903_outer_proc; +go +drop procedure if exists babel_2903_inner_proc; +go +drop table if exists babel_2903_t1; +go diff --git a/test/JDBC/expected/parallel_query/BABEL-2998.out b/test/JDBC/expected/parallel_query/BABEL-2998.out new file mode 100644 index 0000000000..093d1eab99 --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-2998.out @@ -0,0 +1,99 @@ +-- tsql +-- typmod associated with NULL will be -1 so this will throw an error +SELECT CAST('1' AS CHAR(10)) AS Col1 +UNION +SELECT NULL AS Col1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +SELECT CAST('1' AS CHAR(10)) AS Col1 +UNION ALL +SELECT NULL AS Col1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- taking suggestion from above error, added explicit CAST and CONVERT +SELECT CAST('1' AS CHAR(10)) AS Col1 +UNION +SELECT CAST(NULL AS CHAR(10)) AS Col1 +GO +~~START~~ +char +1 + +~~END~~ + + +SELECT CAST('1' AS CHAR(10)) AS Col1 +UNION ALL +SELECT CONVERT(CHAR(10), NULL) AS Col1 +GO +~~START~~ +char + +1 +~~END~~ + + +SELECT CAST('1' AS CHAR(10)) AS Col1 +UNION ALL +SELECT CAST(NULL AS CHAR(10)) AS Col1 +GO +~~START~~ +char + +1 +~~END~~ + + +SELECT CAST('1' AS CHAR(10)) AS Col1 +UNION +SELECT CONVERT(CHAR(10), NULL) AS Col1 +GO +~~START~~ +char +1 + +~~END~~ + + +-- psql +-- create a function from PG endpoint and try calling it from T-SQL endpoint +CREATE FUNCTION sys.func_2998() RETURNS CHAR(20) LANGUAGE SQL RETURN 'abc'; +GO + +-- tsql +-- throws error +SELECT func_2998() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- taking suggestion from above error, added explicit CAST and CONVERT +SELECT CAST(func_2998() AS CHAR(20)) +GO +~~START~~ +char +abc +~~END~~ + + +SELECT CONVERT(CHAR(20), func_2998()) +GO +~~START~~ +char +abc +~~END~~ + + +-- psql +DROP FUNCTION sys.func_2998() +GO diff --git a/test/JDBC/expected/parallel_query/BABEL-3248.out b/test/JDBC/expected/parallel_query/BABEL-3248.out new file mode 100644 index 0000000000..b72dce8754 --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-3248.out @@ -0,0 +1,119 @@ +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select current_setting('babelfishpg_tsql.escape_hatch_showplan_all'); +go +~~START~~ +text +strict +~~END~~ + + +-- SHOWPLAN_ALL and STATISTICS PROFILE should be ignored +set showplan_all on; +go +select 1; +go +~~START~~ +int +1 +~~END~~ + +set showplan_all off; +go +set statistics profile on; +go +select 1; +go +~~START~~ +int +1 +~~END~~ + +set statistics profile off; +go + +-- SHOWPLAN_ALL and STATISTICS PROFILE should return BBF query plans +EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_showplan_all', 'ignore'; +go + +set showplan_all on; +go +select 1; +go +~~START~~ +text +Query Text: select 1 +Gather + Workers Planned: 1 + Single Copy: true + -> Result +~~END~~ + +set showplan_all off; +go +set statistics profile on; +go +select 1; +go +~~START~~ +int +1 +~~END~~ + +~~START~~ +text +Query Text: select 1 +Gather (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Result (actual rows=1 loops=1) +~~END~~ + +set statistics profile off; +go + +-- clean up +EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_showplan_all', 'strict'; +go + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go +~~START~~ +text +on +~~END~~ + diff --git a/test/JDBC/expected/parallel_query/BABEL-328-vu-verify.out b/test/JDBC/expected/parallel_query/BABEL-328-vu-verify.out new file mode 100644 index 0000000000..3859fc36de --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-328-vu-verify.out @@ -0,0 +1,176 @@ +SELECT * FROM babel_328_vu_v1 +GO +~~START~~ +varchar +Engineering +Administration +Sales +Sales +~~END~~ + + +SELECT * FROM babel_328_vu_v2 +GO +~~START~~ +varchar +Engineering +Administration +Sales +Sales +~~END~~ + + +SELECT * FROM babel_328_vu_v3 +GO +~~START~~ +varchar +Engineering +Administration +Sales +Sales +Marketing +Finance +~~END~~ + + +SELECT * FROM babel_328_vu_v4 +GO +~~START~~ +varchar +Engineering +Administration +Sales +Sales +Marketing +Finance +~~END~~ + + +EXEC babel_328_vu_p1 +GO +~~START~~ +int#!#varchar#!#int#!#varchar#!#varchar#!#int +1#!#Engineering#!#1#!#Orlando#!#Gee#!#1 +2#!#Administration#!#2#!#Keith#!#Harris#!#2 +3#!#Sales#!#3#!#Donna#!#Carreras#!#3 +3#!#Sales#!#4#!#Janet#!#Gates#!#3 +~~END~~ + + +EXEC babel_328_vu_p2 +GO +~~START~~ +int#!#varchar#!#int#!#varchar#!#varchar#!#int +3#!#Sales#!#3#!#Donna#!#Carreras#!#3 +3#!#Sales#!#4#!#Janet#!#Gates#!#3 +~~END~~ + + +EXEC babel_328_vu_p3 +GO +~~START~~ +int#!#varchar#!#int#!#varchar#!#varchar#!#int +1#!#Engineering#!#1#!#Orlando#!#Gee#!#1 +2#!#Administration#!#2#!#Keith#!#Harris#!#2 +3#!#Sales#!#3#!#Donna#!#Carreras#!#3 +3#!#Sales#!#4#!#Janet#!#Gates#!#3 +4#!#Marketing#!##!##!##!# +5#!#Finance#!##!##!##!# +~~END~~ + + +EXEC babel_328_vu_p4 +GO +~~START~~ +int#!#varchar#!#int#!#varchar#!#varchar#!#int +3#!#Sales#!#3#!#Donna#!#Carreras#!#3 +3#!#Sales#!#4#!#Janet#!#Gates#!#3 +~~END~~ + + +SELECT * FROM babel_328_vu_v5 +GO +~~START~~ +int#!#int#!#int#!#int#!#int#!#int +1#!#1#!#3#!#3#!#5#!#5 +1#!#1#!#3#!#3#!#6#!#6 +1#!#1#!#4#!#4#!#5#!#5 +1#!#1#!#4#!#4#!#6#!#6 +2#!#2#!#3#!#3#!#5#!#5 +2#!#2#!#3#!#3#!#6#!#6 +2#!#2#!#4#!#4#!#5#!#5 +2#!#2#!#4#!#4#!#6#!#6 +~~END~~ + + +SELECT * FROM babel_328_vu_v6 +GO +~~START~~ +int#!#int#!#int#!#int#!#int#!#int +1#!#1#!#3#!#3#!#5#!#5 +1#!#1#!#4#!#4#!#5#!#5 +1#!#1#!#3#!#3#!#6#!#6 +1#!#1#!#4#!#4#!#6#!#6 +2#!#2#!#3#!#3#!#5#!#5 +2#!#2#!#4#!#4#!#5#!#5 +2#!#2#!#3#!#3#!#6#!#6 +2#!#2#!#4#!#4#!#6#!#6 +~~END~~ + + +SELECT * FROM babel_328_vu_f2() +GO +~~START~~ +datetime +2021-12-12 00:00:00.0 +~~END~~ + + +--These calls should return an error +SELECT * FROM babel_328_vu_t1 D +CROSS babel_328_vu_t2 E +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'babel_328_vu_t2' at line 3 and character position 6)~~ + + +SELECT * FROM babel_328_vu_t1 D +OUTER babel_328_vu_t2 E +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'babel_328_vu_t2' at line 2 and character position 6)~~ + + +SELECT * FROM babel_328_vu_t1 d +CROSS APPLY (SELECT * FROM babel_328_vu_t2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: subquery in APPLY must have an alias)~~ + + +SELECT * FROM babel_328_vu_t1 d +OUTER APPLY (SELECT * FROM babel_328_vu_t2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: subquery in APPLY must have an alias)~~ + + +SELECT * FROM babel_328_vu_t1 d +CROSS APPLY (VALUES (3,3),(4,4)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: VALUES in APPLY must have an alias)~~ + + +SELECT * FROM babel_328_vu_t1 d +OUTER APPLY (VALUES (3,3),(4,4)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: VALUES in APPLY must have an alias)~~ + diff --git a/test/JDBC/expected/parallel_query/BABEL-3295.out b/test/JDBC/expected/parallel_query/BABEL-3295.out new file mode 100644 index 0000000000..150ca7ff1d --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-3295.out @@ -0,0 +1,171 @@ +drop table if exists babel_3295_t1 +go + +drop table if exists babel_3295_t2 +go + +create table babel_3295_t1(a1 int PRIMARY KEY, b1 int) +go + +create index index_babel_3295_t1_b1 on babel_3295_t1(b1) +go + +create table babel_3295_t2(a2 int PRIMARY KEY, b2 int) +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false) +go +~~START~~ +text +off +~~END~~ + + +set babelfish_showplan_all on +go + +/* + * Run multiple queries and give different hints + * The hints should not be applied as the GUC babelfishpg_tsql.enable_pg_hint has not been enabled + */ +select * from babel_3295_t1 (index(index_babel_3295_t1_b1)) where b1 = 1 +go +~~START~~ +text +Query Text: select/*+ indexscan(babel_3295_t1 index_babel_3295_t1_b1babel_329f054c0439acbb57ada93af5f2888cbf7) */ * from babel_3295_t1 where b1 = 1 +Gather + Workers Planned: 1 + Single Copy: true + -> Bitmap Heap Scan on babel_3295_t1 + Recheck Cond: (b1 = 1) + -> Bitmap Index Scan on index_babel_3295_t1_b1babel_329f054c0439acbb57ada93af5f2888cbf7 + Index Cond: (b1 = 1) +~~END~~ + + +select * from babel_3295_t1 where b1 = 1 option(table hint(babel_3295_t1, index(index_babel_3295_t1_b1))) +go +~~START~~ +text +Query Text: select/*+ indexscan(babel_3295_t1 index_babel_3295_t1_b1babel_329f054c0439acbb57ada93af5f2888cbf7) */ * from babel_3295_t1 where b1 = 1 +Gather + Workers Planned: 1 + Single Copy: true + -> Bitmap Heap Scan on babel_3295_t1 + Recheck Cond: (b1 = 1) + -> Bitmap Index Scan on index_babel_3295_t1_b1babel_329f054c0439acbb57ada93af5f2888cbf7 + Index Cond: (b1 = 1) +~~END~~ + + +select * from babel_3295_t1 inner merge join babel_3295_t2 on babel_3295_t1.a1 = babel_3295_t2.a2 +go +~~START~~ +text +Query Text: select/*+ mergejoin(babel_3295_t1 babel_3295_t2) leading(babel_3295_t1 babel_3295_t2)*/ * from babel_3295_t1 inner join babel_3295_t2 on babel_3295_t1.a1 = babel_3295_t2.a2 +Gather + Workers Planned: 3 + -> Parallel Hash Join + Hash Cond: (babel_3295_t1.a1 = babel_3295_t2.a2) + -> Parallel Seq Scan on babel_3295_t1 + -> Parallel Hash + -> Parallel Seq Scan on babel_3295_t2 +~~END~~ + + +select * from babel_3295_t1 join babel_3295_t2 on babel_3295_t1.a1 = babel_3295_t2.a2 option(merge join) +go +~~START~~ +text +Query Text: select/*+ set(enable_nestloop off) set(enable_hashjoin off) */ * from babel_3295_t1 join babel_3295_t2 on babel_3295_t1.a1 = babel_3295_t2.a2 +Gather + Workers Planned: 3 + -> Parallel Hash Join + Hash Cond: (babel_3295_t1.a1 = babel_3295_t2.a2) + -> Parallel Seq Scan on babel_3295_t1 + -> Parallel Hash + -> Parallel Seq Scan on babel_3295_t2 +~~END~~ + + +set babelfish_showplan_all off +go + +select set_config('babelfishpg_tsql.enable_pg_hint', 'on', false); +go +~~START~~ +text +on +~~END~~ + + +set babelfish_showplan_all on +go + +/* + * Run the queries again + * The hints should now be applied as the GUC for hint mapping has ben enabled + */ +select * from babel_3295_t1 (index(index_babel_3295_t1_b1)) where b1 = 1 +go +~~START~~ +text +Query Text: select/*+ indexscan(babel_3295_t1 index_babel_3295_t1_b1babel_329f054c0439acbb57ada93af5f2888cbf7) */ * from babel_3295_t1 where b1 = 1 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using index_babel_3295_t1_b1babel_329f054c0439acbb57ada93af5f2888cbf7 on babel_3295_t1 + Index Cond: (b1 = 1) +~~END~~ + + +select * from babel_3295_t1 where b1 = 1 option(table hint(babel_3295_t1, index(index_babel_3295_t1_b1))) +go +~~START~~ +text +Query Text: select/*+ indexscan(babel_3295_t1 index_babel_3295_t1_b1babel_329f054c0439acbb57ada93af5f2888cbf7) */ * from babel_3295_t1 where b1 = 1 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using index_babel_3295_t1_b1babel_329f054c0439acbb57ada93af5f2888cbf7 on babel_3295_t1 + Index Cond: (b1 = 1) +~~END~~ + + +select * from babel_3295_t1 inner merge join babel_3295_t2 on babel_3295_t1.a1 = babel_3295_t2.a2 +go +~~START~~ +text +Query Text: select/*+ mergejoin(babel_3295_t1 babel_3295_t2) leading(babel_3295_t1 babel_3295_t2)*/ * from babel_3295_t1 inner join babel_3295_t2 on babel_3295_t1.a1 = babel_3295_t2.a2 +Gather + Workers Planned: 1 + -> Merge Join + Merge Cond: (babel_3295_t1.a1 = babel_3295_t2.a2) + -> Parallel Index Scan using babel_3295_t1_pkey on babel_3295_t1 + -> Index Scan using babel_3295_t2_pkey on babel_3295_t2 +~~END~~ + + +select * from babel_3295_t1 join babel_3295_t2 on babel_3295_t1.a1 = babel_3295_t2.a2 option(merge join) +go +~~START~~ +text +Query Text: select/*+ set(enable_nestloop off) set(enable_hashjoin off) */ * from babel_3295_t1 join babel_3295_t2 on babel_3295_t1.a1 = babel_3295_t2.a2 +Gather + Workers Planned: 1 + -> Merge Join + Merge Cond: (babel_3295_t1.a1 = babel_3295_t2.a2) + -> Parallel Index Scan using babel_3295_t1_pkey on babel_3295_t1 + -> Index Scan using babel_3295_t2_pkey on babel_3295_t2 +~~END~~ + + +set babelfish_showplan_all off +go + +-- cleanup +drop table babel_3295_t1 +go + +drop table babel_3295_t2 +go diff --git a/test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out b/test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out new file mode 100644 index 0000000000..297856cf9e --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out @@ -0,0 +1,97 @@ +-- tsql +CREATE TABLE babel_3513_t1(a1 int PRIMARY KEY, b1 int, c1 int) +GO + +CREATE TABLE babel_3513_t2(a2 int PRIMARY KEY, b2 int, c2 int) +GO + +CREATE PROCEDURE babel_3513_proc_1 AS SELECT babel_3513_t1.a1 FROM babel_3513_t1 inner merge join babel_3513_t2 ON a1 = b2 +GO + +-- psql +analyze master_dbo.babel_3513_t1; +go + +analyze master_dbo.babel_3513_t2; +go + +-- tsql +SELECT set_config('babelfishpg_tsql.explain_costs', 'off', false) +GO +~~START~~ +text +off +~~END~~ + + +set babelfish_showplan_all on; +go + + +-- expect nested loop join +exec babel_3513_proc_1; +go +~~START~~ +text +Query Text: EXEC babel_3513_proc_1 + Query Text: SELECT/*+ mergejoin(babel_3513_t1 babel_3513_t2) leading(babel_3513_t1 babel_3513_t2)*/ babel_3513_t1.a1 FROM babel_3513_t1 inner join babel_3513_t2 ON a1 = b2 + -> Gather + Workers Planned: 1 + Single Copy: true + -> Nested Loop + Join Filter: (babel_3513_t1.a1 = babel_3513_t2.b2) + -> Seq Scan on babel_3513_t1 + -> Seq Scan on babel_3513_t2 +~~END~~ + +set babelfish_showplan_all off; +go + +exec sp_babelfish_configure 'enable_pg_hint', 'on' +go + +set babelfish_showplan_all on; +go + +-- expect nested loop join because of plan caching +exec babel_3513_proc_1; +go +~~START~~ +text +Query Text: EXEC babel_3513_proc_1 + Query Text: SELECT/*+ mergejoin(babel_3513_t1 babel_3513_t2) leading(babel_3513_t1 babel_3513_t2)*/ babel_3513_t1.a1 FROM babel_3513_t1 inner join babel_3513_t2 ON a1 = b2 + -> Gather + Workers Planned: 1 + Single Copy: true + -> Nested Loop + Join Filter: (babel_3513_t1.a1 = babel_3513_t2.b2) + -> Seq Scan on babel_3513_t1 + -> Seq Scan on babel_3513_t2 +~~END~~ + + +-- expect merge join +SELECT babel_3513_t1.a1 FROM babel_3513_t1 inner merge join babel_3513_t2 ON a1 = b2; +go +~~START~~ +text +Query Text: SELECT/*+ mergejoin(babel_3513_t1 babel_3513_t2) leading(babel_3513_t1 babel_3513_t2)*/ babel_3513_t1.a1 FROM babel_3513_t1 inner join babel_3513_t2 ON a1 = b2 +Gather + Workers Planned: 1 + Single Copy: true + -> Merge Join + Merge Cond: (babel_3513_t1.a1 = babel_3513_t2.b2) + -> Sort + Sort Key: babel_3513_t1.a1 + -> Seq Scan on babel_3513_t1 + -> Sort + Sort Key: babel_3513_t2.b2 + -> Seq Scan on babel_3513_t2 +~~END~~ + + +set babelfish_showplan_all off; +go + +exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server' +go diff --git a/test/JDBC/expected/parallel_query/BABEL-3513-vu-verify.out b/test/JDBC/expected/parallel_query/BABEL-3513-vu-verify.out new file mode 100644 index 0000000000..56fff55810 --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-3513-vu-verify.out @@ -0,0 +1,104 @@ +-- psql +analyze master_dbo.babel_3513_t1; +go + +analyze master_dbo.babel_3513_t2; +go + +-- tsql +SELECT set_config('babelfishpg_tsql.explain_costs', 'off', false) +GO +~~START~~ +text +off +~~END~~ + + +set babelfish_showplan_all on; +go + +-- expect merge join +exec babel_3513_proc_1; +go +~~START~~ +text +Query Text: EXEC babel_3513_proc_1 + Query Text: SELECT/*+ mergejoin(babel_3513_t1 babel_3513_t2) leading(babel_3513_t1 babel_3513_t2)*/ babel_3513_t1.a1 FROM babel_3513_t1 inner join babel_3513_t2 ON a1 = b2 + -> Gather + Workers Planned: 1 + Single Copy: true + -> Merge Join + Merge Cond: (babel_3513_t1.a1 = babel_3513_t2.b2) + -> Sort + Sort Key: babel_3513_t1.a1 + -> Seq Scan on babel_3513_t1 + -> Sort + Sort Key: babel_3513_t2.b2 + -> Seq Scan on babel_3513_t2 +~~END~~ + + +set babelfish_showplan_all off; +go + +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + +set babelfish_showplan_all on; +go + +-- expect merge join because of plan caching +exec babel_3513_proc_1; +go +~~START~~ +text +Query Text: EXEC babel_3513_proc_1 + Query Text: SELECT/*+ mergejoin(babel_3513_t1 babel_3513_t2) leading(babel_3513_t1 babel_3513_t2)*/ babel_3513_t1.a1 FROM babel_3513_t1 inner join babel_3513_t2 ON a1 = b2 + -> Gather + Workers Planned: 1 + Single Copy: true + -> Merge Join + Merge Cond: (babel_3513_t1.a1 = babel_3513_t2.b2) + -> Sort + Sort Key: babel_3513_t1.a1 + -> Seq Scan on babel_3513_t1 + -> Sort + Sort Key: babel_3513_t2.b2 + -> Seq Scan on babel_3513_t2 +~~END~~ + + +-- expect nested loop join +SELECT babel_3513_t1.a1 FROM babel_3513_t1 inner merge join babel_3513_t2 ON a1 = b2; +go +~~START~~ +text +Query Text: SELECT/*+ mergejoin(babel_3513_t1 babel_3513_t2) leading(babel_3513_t1 babel_3513_t2)*/ babel_3513_t1.a1 FROM babel_3513_t1 inner join babel_3513_t2 ON a1 = b2 +Gather + Workers Planned: 1 + Single Copy: true + -> Nested Loop + Join Filter: (babel_3513_t1.a1 = babel_3513_t2.b2) + -> Seq Scan on babel_3513_t1 + -> Seq Scan on babel_3513_t2 +~~END~~ + + +set babelfish_showplan_all off; +go + +-- clean up +drop procedure babel_3513_proc_1; +go +drop table babel_3513_t1; +go +drop table babel_3513_t2; +go + +exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server' +go diff --git a/test/JDBC/expected/parallel_query/BABEL-4281.out b/test/JDBC/expected/parallel_query/BABEL-4281.out new file mode 100644 index 0000000000..701cdfdb0b --- /dev/null +++ b/test/JDBC/expected/parallel_query/BABEL-4281.out @@ -0,0 +1,117 @@ +BEGIN TRAN BABEL4281_T1; +GO + +CREATE TABLE t_babel4281 (a int, b int); +GO + +-- The third parameter is true to set config back to default after transaction is committed +select set_config('parallel_setup_cost', 0, true); +select set_config('parallel_tuple_cost', 0, true); +select set_config('min_parallel_table_scan_size', 0, true); +GO +~~START~~ +text +0 +~~END~~ + +~~START~~ +text +0 +~~END~~ + +~~START~~ +text +0 +~~END~~ + + + +-- show explicitly this is a parallel query plan +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL ON +GO + +select a, count(*) from t_babel4281 group by a order by 2; -- should not crash +GO +~~START~~ +text +Query Text: select a, count(*) from t_babel4281 group by a order by 2 +Sort + Sort Key: (count(*)) NULLS FIRST + -> Finalize HashAggregate + Group Key: a + -> Gather + Workers Planned: 3 + -> Partial HashAggregate + Group Key: a + -> Parallel Seq Scan on t_babel4281 +~~END~~ + + +-- set configurations back +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +-- Verify Output +select a, count(*) from t_babel4281 group by a order by 2; -- should not crash +GO +~~START~~ +int#!#int +~~END~~ + + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +-- Commiting sets parallel_setup_cost, parallel_tuple_cost, min_parallel_table_scan_size back to default +COMMIT TRAN BABEL4281_T1; +GO + + +DROP TABLE t_babel4281; +GO + diff --git a/test/JDBC/expected/parallel_query/TestSQLQueries.out b/test/JDBC/expected/parallel_query/TestSQLQueries.out new file mode 100644 index 0000000000..dda6e46574 --- /dev/null +++ b/test/JDBC/expected/parallel_query/TestSQLQueries.out @@ -0,0 +1,839 @@ +#1 CREATE TABLE with primary and unique keyword +EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_unique_constraint', 'ignore'; +CREATE TABLE tmp(a int PRIMARY KEY, b int UNIQUE); +INSERT INTO tmp(a,b) values(1,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) values(2,2); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +~~END~~ + +DROP TABLE tmp; + +#2 2 table with foreign key relation +#CREATE TABLE tmp1(b int PRIMARY KEY); +#CREATE TABLE tmp2(a int PRIMARY KEY, b int FOREIGN KEY REFERENCES tmp1(b)); +#INSERT INTO tmp1(b) VALUES (1); +#INSERT INTO tmp2(a,b) values(1,1); +#SELECT * FROM tmp1; +#SELECT * FROM tmp2; +#DROP TABLE tmp2; +#DROP TABLE tmp1; + +#3 Repeated #2 with CONSTRAINT keyword +#CREATE TABLE tmp1(b int PRIMARY KEY); +#CREATE TABLE tmp2(a int, b int, PRIMARY KEY(a), CONSTRAINT FK_tmp FOREIGN KEY (b) REFERENCES tmp1(b)); +#INSERT INTO tmp1(b) VALUES (1); +#INSERT INTO tmp2(a,b) values(1,1); +#SELECT * FROM tmp1; +#SELECT * FROM tmp2; +#DROP TABLE tmp2; +#DROP TABLE tmp1; + +#4 CREATE TABLE with NOT NULL column +CREATE TABLE tmp(a int PRIMARY KEY,b int NOT NULL); +INSERT INTO tmp(a,b) values(1,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) values(2,1); +~~ROW COUNT: 1~~ + +#INSERT INTO tmp(a,b) values(2,NULL); +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#1 +~~END~~ + +DROP TABLE tmp; + +#5 INSERTION and DELETION +CREATE TABLE tmp(a int PRIMARY KEY); +INSERT INTO tmp(a) VALUES(1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a) VALUES(2); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a) VALUES(3); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a) VALUES(4); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a) VALUES(5); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int +1 +2 +3 +4 +5 +~~END~~ + +DELETE FROM tmp WHERE a>2; +~~ROW COUNT: 3~~ + +SELECT * FROM tmp; +~~START~~ +int +1 +2 +~~END~~ + +DROP TABLE tmp; + +#6 IS NOT NULL condition in WHERE clause +CREATE TABLE tmp(a int PRIMARY KEY,b int); +INSERT INTO tmp(a,b) values(1,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) values(2,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) values(3,NULL); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) values(4,NULL); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp WHERE b IS NOT NULL; +~~START~~ +int#!#int +1#!#1 +2#!#1 +~~END~~ + +DROP TABLE tmp; + +#7 Add new column using ALTER TABLE +CREATE TABLE tmp(a int PRIMARY KEY); +INSERT INTO tmp(a) VALUES(1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a) VALUES(2); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int +1 +2 +~~END~~ + +ALTER TABLE tmp ADD b VARCHAR(20) NULL; +SELECT * FROM tmp; +~~START~~ +int#!#varchar +1#!# +2#!# +~~END~~ + +INSERT INTO tmp(a,b) VALUES(4,'Dipesh'); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(5,' Dipesh'); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#varchar +1#!# +2#!# +4#!#Dipesh +5#!# Dipesh +~~END~~ + +DROP TABLE tmp; + +#8 Repeated #8 with default value for newly added col +CREATE TABLE tmp(a int PRIMARY KEY); +INSERT INTO tmp(a) VALUES(1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a) VALUES(2); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int +1 +2 +~~END~~ + +ALTER TABLE tmp ADD b VARCHAR(20) DEFAULT 'Dipesj'; +SELECT * FROM tmp; +~~START~~ +int#!#varchar +1#!#Dipesj +2#!#Dipesj +~~END~~ + +INSERT INTO tmp(a,b) VALUES(4,'Dipesh'); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(5,' Dipesh'); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#varchar +1#!#Dipesj +2#!#Dipesj +4#!#Dipesh +5#!# Dipesh +~~END~~ + +DROP TABLE tmp; + +#9 Change datatype of existing column using ALTER TABLE +CREATE TABLE tmp(a int PRIMARY KEY,b int); +INSERT INTO tmp(a,b) VALUES(1,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(2,2); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +~~END~~ + +ALTER TABLE tmp ALTER COLUMN b VARCHAR(10); +SELECT * FROM tmp; +~~START~~ +int#!#varchar +1#!#1 +2#!#2 +~~END~~ + +INSERT INTO tmp(a,b) VALUES(4,'Dipesh'); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(5,' Dipesh'); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#varchar +1#!#1 +2#!#2 +4#!#Dipesh +5#!# Dipesh +~~END~~ + +DROP TABLE tmp; + +#10 UPDATE TABLE with fancy condition +CREATE TABLE tmp(a int PRIMARY KEY,b int); +INSERT INTO tmp(a,b) VALUES(1,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(2,2); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(3,3); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(4,4); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(5,5); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +3#!#3 +4#!#4 +5#!#5 +~~END~~ + +UPDATE tmp SET b=b+1 WHERE b>2; +~~ROW COUNT: 3~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +3#!#4 +4#!#5 +5#!#6 +~~END~~ + +DROP TABLE tmp; + +#11 DROP some column using ALTER TABLE +CREATE TABLE tmp(a int PRIMARY KEY,b int); +INSERT INTO tmp(a,b) VALUES(1,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(2,2); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(3,3); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(4,4); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(5,5); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +3#!#3 +4#!#4 +5#!#5 +~~END~~ + +#ALTER TABLE tmp DROP COLUMN b; +#INSERT INTO tmp(a) values (6); +#SELECT * FROM tmp; +DROP TABLE tmp; + +#12 CREATE TABLE with fancy constraint +CREATE TABLE tmp(a int PRIMARY KEY CHECK (a>10),b int); +INSERT INTO tmp(a,b) VALUES(11,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(12,2); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(13,3); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(14,4); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(15,5); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +11#!#1 +12#!#2 +13#!#3 +14#!#4 +15#!#5 +~~END~~ + +DROP TABLE tmp; + +#CREATE PROCEDURE tmp AS +#BEGIN +# CREATE TABLE dip(a int PRIMARY KEY CHECK (a>10),b int); +# INSERT INTO dip(a,b) VALUES(11,1); +# INSERT INTO dip(a,b) VALUES(12,2); +# INSERT INTO dip(a,b) VALUES(13,3); +# INSERT INTO dip(a,b) VALUES(14,4); +# INSERT INTO dip(a,b) VALUES(15,5); +# SELECT * FROM dip; +# DROP TABLE dip; +#END; + +#13 invoke simple stored procedure using EXECUTE +EXECUTE tmp; +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: procedure tmp() does not exist)~~ + + +#14 invoke simple stored procedure using EXEC +EXEC tmp; +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: procedure tmp() does not exist)~~ + + +#DROP PROCEDURE tmp; + +#15 UPDATE rows in existing table +CREATE TABLE tmp(a int PRIMARY KEY,b int); +INSERT INTO tmp(a,b) VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +~~ROW COUNT: 5~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +3#!#3 +4#!#4 +5#!#5 +~~END~~ + +UPDATE tmp SET b=b*2+1 WHERE (a>2); +~~ROW COUNT: 3~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +3#!#7 +4#!#9 +5#!#11 +~~END~~ + +DROP TABLE tmp; + +#16 TRUNCATE table +CREATE TABLE tmp(a int PRIMARY KEY,b int); +INSERT INTO tmp(a,b) VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +~~ROW COUNT: 5~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +3#!#3 +4#!#4 +5#!#5 +~~END~~ + +TRUNCATE TABLE tmp; +SELECT * FROM tmp; +~~START~~ +int#!#int +~~END~~ + +DROP TABLE tmp; + +CREATE TABLE temp1 (i INT,j INT,t TEXT); + +CREATE TABLE temp2 ( i INT,k INT); + +INSERT INTO temp1 VALUES (1, 4, 'one'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (2, 3, 'two'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (3, 2, 'three'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (4, 1, 'four'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (5, 0, 'five'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (6, 6, 'six'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (7, 7, 'seven'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (8, 8, 'eight'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (0, NULL, 'zero'); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (NULL, NULL, NULL); +~~ROW COUNT: 1~~ + +INSERT INTO temp1 VALUES (NULL, 0, 'zero'); +~~ROW COUNT: 1~~ + + +INSERT INTO temp2 VALUES (1, -1); +~~ROW COUNT: 1~~ + +INSERT INTO temp2 VALUES (2, 2); +~~ROW COUNT: 1~~ + +INSERT INTO temp2 VALUES (3, -3); +~~ROW COUNT: 1~~ + +INSERT INTO temp2 VALUES (2, 4); +~~ROW COUNT: 1~~ + +INSERT INTO temp2 VALUES (5, -5); +~~ROW COUNT: 1~~ + +INSERT INTO temp2 VALUES (5, -5); +~~ROW COUNT: 1~~ + +INSERT INTO temp2 VALUES (0, NULL); +~~ROW COUNT: 1~~ + +INSERT INTO temp2 VALUES (NULL, NULL); +~~ROW COUNT: 1~~ + +INSERT INTO temp2 VALUES (NULL, 0); +~~ROW COUNT: 1~~ + + +#17 CROSS JOIN +SELECT * FROM temp1 CROSS JOIN temp2; +~~START~~ +int#!#int#!#text#!#int#!#int +1#!#4#!#one#!#1#!#-1 +2#!#3#!#two#!#1#!#-1 +3#!#2#!#three#!#1#!#-1 +4#!#1#!#four#!#1#!#-1 +5#!#0#!#five#!#1#!#-1 +6#!#6#!#six#!#1#!#-1 +7#!#7#!#seven#!#1#!#-1 +8#!#8#!#eight#!#1#!#-1 +0#!##!#zero#!#1#!#-1 +#!##!##!#1#!#-1 +#!#0#!#zero#!#1#!#-1 +1#!#4#!#one#!#2#!#2 +2#!#3#!#two#!#2#!#2 +3#!#2#!#three#!#2#!#2 +4#!#1#!#four#!#2#!#2 +5#!#0#!#five#!#2#!#2 +6#!#6#!#six#!#2#!#2 +7#!#7#!#seven#!#2#!#2 +8#!#8#!#eight#!#2#!#2 +0#!##!#zero#!#2#!#2 +#!##!##!#2#!#2 +#!#0#!#zero#!#2#!#2 +1#!#4#!#one#!#3#!#-3 +2#!#3#!#two#!#3#!#-3 +3#!#2#!#three#!#3#!#-3 +4#!#1#!#four#!#3#!#-3 +5#!#0#!#five#!#3#!#-3 +6#!#6#!#six#!#3#!#-3 +7#!#7#!#seven#!#3#!#-3 +8#!#8#!#eight#!#3#!#-3 +0#!##!#zero#!#3#!#-3 +#!##!##!#3#!#-3 +#!#0#!#zero#!#3#!#-3 +1#!#4#!#one#!#2#!#4 +2#!#3#!#two#!#2#!#4 +3#!#2#!#three#!#2#!#4 +4#!#1#!#four#!#2#!#4 +5#!#0#!#five#!#2#!#4 +6#!#6#!#six#!#2#!#4 +7#!#7#!#seven#!#2#!#4 +8#!#8#!#eight#!#2#!#4 +0#!##!#zero#!#2#!#4 +#!##!##!#2#!#4 +#!#0#!#zero#!#2#!#4 +1#!#4#!#one#!#5#!#-5 +2#!#3#!#two#!#5#!#-5 +3#!#2#!#three#!#5#!#-5 +4#!#1#!#four#!#5#!#-5 +5#!#0#!#five#!#5#!#-5 +6#!#6#!#six#!#5#!#-5 +7#!#7#!#seven#!#5#!#-5 +8#!#8#!#eight#!#5#!#-5 +0#!##!#zero#!#5#!#-5 +#!##!##!#5#!#-5 +#!#0#!#zero#!#5#!#-5 +1#!#4#!#one#!#5#!#-5 +2#!#3#!#two#!#5#!#-5 +3#!#2#!#three#!#5#!#-5 +4#!#1#!#four#!#5#!#-5 +5#!#0#!#five#!#5#!#-5 +6#!#6#!#six#!#5#!#-5 +7#!#7#!#seven#!#5#!#-5 +8#!#8#!#eight#!#5#!#-5 +0#!##!#zero#!#5#!#-5 +#!##!##!#5#!#-5 +#!#0#!#zero#!#5#!#-5 +1#!#4#!#one#!#0#!# +2#!#3#!#two#!#0#!# +3#!#2#!#three#!#0#!# +4#!#1#!#four#!#0#!# +5#!#0#!#five#!#0#!# +6#!#6#!#six#!#0#!# +7#!#7#!#seven#!#0#!# +8#!#8#!#eight#!#0#!# +0#!##!#zero#!#0#!# +#!##!##!#0#!# +#!#0#!#zero#!#0#!# +1#!#4#!#one#!##!# +2#!#3#!#two#!##!# +3#!#2#!#three#!##!# +4#!#1#!#four#!##!# +5#!#0#!#five#!##!# +6#!#6#!#six#!##!# +7#!#7#!#seven#!##!# +8#!#8#!#eight#!##!# +0#!##!#zero#!##!# +#!##!##!##!# +#!#0#!#zero#!##!# +1#!#4#!#one#!##!#0 +2#!#3#!#two#!##!#0 +3#!#2#!#three#!##!#0 +4#!#1#!#four#!##!#0 +5#!#0#!#five#!##!#0 +6#!#6#!#six#!##!#0 +7#!#7#!#seven#!##!#0 +8#!#8#!#eight#!##!#0 +0#!##!#zero#!##!#0 +#!##!##!##!#0 +#!#0#!#zero#!##!#0 +~~END~~ + + +#18 INNER JOIN +SELECT temp1.i, temp1.j, temp1.t, temp2.k FROM temp1 INNER JOIN temp2 ON temp1.i=temp2.i; +~~START~~ +int#!#int#!#text#!#int +1#!#4#!#one#!#-1 +2#!#3#!#two#!#2 +3#!#2#!#three#!#-3 +2#!#3#!#two#!#4 +5#!#0#!#five#!#-5 +5#!#0#!#five#!#-5 +0#!##!#zero#!# +~~END~~ + +SELECT temp1.i, temp1.j, temp1.t, temp2.k FROM temp1 JOIN temp2 ON temp1.i=temp2.i; +~~START~~ +int#!#int#!#text#!#int +1#!#4#!#one#!#-1 +2#!#3#!#two#!#2 +3#!#2#!#three#!#-3 +2#!#3#!#two#!#4 +5#!#0#!#five#!#-5 +5#!#0#!#five#!#-5 +0#!##!#zero#!# +~~END~~ + + +#19 LEFT JOIN +SELECT * FROM temp1 LEFT OUTER JOIN temp2 ON temp1.i=temp2.k; +~~START~~ +int#!#int#!#text#!#int#!#int +1#!#4#!#one#!##!# +2#!#3#!#two#!#2#!#2 +3#!#2#!#three#!##!# +4#!#1#!#four#!#2#!#4 +5#!#0#!#five#!##!# +6#!#6#!#six#!##!# +7#!#7#!#seven#!##!# +8#!#8#!#eight#!##!# +0#!##!#zero#!##!#0 +#!##!##!##!# +#!#0#!#zero#!##!# +~~END~~ + + +#20 RIGHT JOIN +SELECT * FROM temp1 RIGHT OUTER JOIN temp2 ON temp1.i=temp2.i; +~~START~~ +int#!#int#!#text#!#int#!#int +1#!#4#!#one#!#1#!#-1 +2#!#3#!#two#!#2#!#2 +3#!#2#!#three#!#3#!#-3 +2#!#3#!#two#!#2#!#4 +5#!#0#!#five#!#5#!#-5 +5#!#0#!#five#!#5#!#-5 +0#!##!#zero#!#0#!# +#!##!##!##!# +#!##!##!##!#0 +~~END~~ + + +#21 FULL OUTER JOIN +SELECT * FROM temp1,temp2; +~~START~~ +int#!#int#!#text#!#int#!#int +1#!#4#!#one#!#1#!#-1 +2#!#3#!#two#!#1#!#-1 +3#!#2#!#three#!#1#!#-1 +4#!#1#!#four#!#1#!#-1 +5#!#0#!#five#!#1#!#-1 +6#!#6#!#six#!#1#!#-1 +7#!#7#!#seven#!#1#!#-1 +8#!#8#!#eight#!#1#!#-1 +0#!##!#zero#!#1#!#-1 +#!##!##!#1#!#-1 +#!#0#!#zero#!#1#!#-1 +1#!#4#!#one#!#2#!#2 +2#!#3#!#two#!#2#!#2 +3#!#2#!#three#!#2#!#2 +4#!#1#!#four#!#2#!#2 +5#!#0#!#five#!#2#!#2 +6#!#6#!#six#!#2#!#2 +7#!#7#!#seven#!#2#!#2 +8#!#8#!#eight#!#2#!#2 +0#!##!#zero#!#2#!#2 +#!##!##!#2#!#2 +#!#0#!#zero#!#2#!#2 +1#!#4#!#one#!#3#!#-3 +2#!#3#!#two#!#3#!#-3 +3#!#2#!#three#!#3#!#-3 +4#!#1#!#four#!#3#!#-3 +5#!#0#!#five#!#3#!#-3 +6#!#6#!#six#!#3#!#-3 +7#!#7#!#seven#!#3#!#-3 +8#!#8#!#eight#!#3#!#-3 +0#!##!#zero#!#3#!#-3 +#!##!##!#3#!#-3 +#!#0#!#zero#!#3#!#-3 +1#!#4#!#one#!#2#!#4 +2#!#3#!#two#!#2#!#4 +3#!#2#!#three#!#2#!#4 +4#!#1#!#four#!#2#!#4 +5#!#0#!#five#!#2#!#4 +6#!#6#!#six#!#2#!#4 +7#!#7#!#seven#!#2#!#4 +8#!#8#!#eight#!#2#!#4 +0#!##!#zero#!#2#!#4 +#!##!##!#2#!#4 +#!#0#!#zero#!#2#!#4 +1#!#4#!#one#!#5#!#-5 +2#!#3#!#two#!#5#!#-5 +3#!#2#!#three#!#5#!#-5 +4#!#1#!#four#!#5#!#-5 +5#!#0#!#five#!#5#!#-5 +6#!#6#!#six#!#5#!#-5 +7#!#7#!#seven#!#5#!#-5 +8#!#8#!#eight#!#5#!#-5 +0#!##!#zero#!#5#!#-5 +#!##!##!#5#!#-5 +#!#0#!#zero#!#5#!#-5 +1#!#4#!#one#!#5#!#-5 +2#!#3#!#two#!#5#!#-5 +3#!#2#!#three#!#5#!#-5 +4#!#1#!#four#!#5#!#-5 +5#!#0#!#five#!#5#!#-5 +6#!#6#!#six#!#5#!#-5 +7#!#7#!#seven#!#5#!#-5 +8#!#8#!#eight#!#5#!#-5 +0#!##!#zero#!#5#!#-5 +#!##!##!#5#!#-5 +#!#0#!#zero#!#5#!#-5 +1#!#4#!#one#!#0#!# +2#!#3#!#two#!#0#!# +3#!#2#!#three#!#0#!# +4#!#1#!#four#!#0#!# +5#!#0#!#five#!#0#!# +6#!#6#!#six#!#0#!# +7#!#7#!#seven#!#0#!# +8#!#8#!#eight#!#0#!# +0#!##!#zero#!#0#!# +#!##!##!#0#!# +#!#0#!#zero#!#0#!# +1#!#4#!#one#!##!# +2#!#3#!#two#!##!# +3#!#2#!#three#!##!# +4#!#1#!#four#!##!# +5#!#0#!#five#!##!# +6#!#6#!#six#!##!# +7#!#7#!#seven#!##!# +8#!#8#!#eight#!##!# +0#!##!#zero#!##!# +#!##!##!##!# +#!#0#!#zero#!##!# +1#!#4#!#one#!##!#0 +2#!#3#!#two#!##!#0 +3#!#2#!#three#!##!#0 +4#!#1#!#four#!##!#0 +5#!#0#!#five#!##!#0 +6#!#6#!#six#!##!#0 +7#!#7#!#seven#!##!#0 +8#!#8#!#eight#!##!#0 +0#!##!#zero#!##!#0 +#!##!##!##!#0 +#!#0#!#zero#!##!#0 +~~END~~ + + +DROP TABLE temp1; +DROP TABLE temp2; + +#22 dropping all columns +CREATE TABLE tmp(a int PRIMARY KEY,b int); +INSERT INTO tmp(a,b) VALUES(1,1); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(2,2); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(3,3); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(4,4); +~~ROW COUNT: 1~~ + +INSERT INTO tmp(a,b) VALUES(5,5); +~~ROW COUNT: 1~~ + +SELECT * FROM tmp; +~~START~~ +int#!#int +1#!#1 +2#!#2 +3#!#3 +4#!#4 +5#!#5 +~~END~~ + +#ALTER TABLE tmp DROP COLUMN b; +#ALTER TABLE tmp DROP COLUMN a; +#SELECT * FROM tmp; +DROP TABLE tmp; + +#23 +CREATE TABLE DATE_dt (a DATE); +INSERT INTO DATE_dt(a) values('2000-12-13'); +~~ROW COUNT: 1~~ + +INSERT INTO DATE_dt(a) values('1900-02-28'); +~~ROW COUNT: 1~~ + +INSERT INTO DATE_dt(a) values('0001-01-01'); +~~ROW COUNT: 1~~ + +INSERT INTO DATE_dt(a) values('9999-12-31'); +~~ROW COUNT: 1~~ + +INSERT INTO DATE_dt(a) values(NULL); +~~ROW COUNT: 1~~ + +SELECT * FROM DATE_dt; +~~START~~ +date +2000-12-13 +1900-02-28 +0001-01-01 +9999-12-31 + +~~END~~ + +ALTER TABLE DATE_dt ALTER COLUMN a DATETIME; +~~ERROR (Code: 517)~~ + +~~ERROR (Message: data out of range for datetime)~~ + +SELECT * FROM DATE_dt; +~~START~~ +date +2000-12-13 +1900-02-28 +0001-01-01 +9999-12-31 + +~~END~~ + +DROP TABLE DATE_dt; +EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_unique_constraint', 'strict'; diff --git a/test/JDBC/expected/parallel_query/babel_collection.out b/test/JDBC/expected/parallel_query/babel_collection.out new file mode 100644 index 0000000000..2b06d9b037 --- /dev/null +++ b/test/JDBC/expected/parallel_query/babel_collection.out @@ -0,0 +1,899 @@ +-- nvarchar is not supported in PG +create table testing1(col nvarchar(60)); -- expect this to fail in the Postgres dialect +GO + +-- check the babelfish version +select cast( + case + when cast(sys.SERVERPROPERTY('BabelfishVersion') as varchar(20)) LIKE '_._._' + THEN 'valid' + else 'invalid' + end as sys.varchar(20)); +GO +~~START~~ +varchar +valid +~~END~~ + +-- nvarchar is supported in tsql dialect +insert into testing1 (col) select N'Muffler'; +insert into testing1 (col) select N'Mülle'; +insert into testing1 (col) select N'MX Systems'; +insert into testing1 (col) select N'Magic'; +select * from testing1 order by col; +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~START~~ +nvarchar +Magic +Muffler +Mülle +MX Systems +~~END~~ + + +-- test case insensitive collation +create table testing2 (col varchar(20) collate SQL_Latin1_General_CP1_CI_AS); +GO + +insert into testing2 values ('JONES'); +insert into testing2 values ('jones'); +insert into testing2 values ('Jones'); +insert into testing2 values ('JoNes'); +insert into testing2 values ('JoNés'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +select * from testing2 where col collate BBF_Unicode_General_CS_AS = 'JoNes'; +GO +~~START~~ +varchar +JoNes +~~END~~ + +select * from testing2 where col collate BBF_Unicode_General_CI_AS = 'JoNes'; +GO +~~START~~ +varchar +JONES +jones +Jones +JoNes +~~END~~ + +select * from testing2 where col collate BBF_Unicode_General_CI_AI = 'JoNes'; +GO +~~START~~ +varchar +JONES +jones +Jones +JoNes +JoNés +~~END~~ + +select * from testing2 where col collate BBF_Unicode_General_CS_AI = 'JoNes'; +GO +~~START~~ +varchar +JoNes +JoNés +~~END~~ + + +-- test case insensitivity for default collation +create table testing3 (c1 varchar(20), c2 char(20), c3 nvarchar(20)); +GO + +insert into testing3 values ('JONES','JONES','JONES'); +insert into testing3 values ('JoneS','JoneS','JoneS'); +insert into testing3 values ('jOnes','jOnes','jOnes'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +select c1 from testing3 where c1='jones'; +GO +~~START~~ +varchar +JONES +JoneS +jOnes +~~END~~ + +select c2 from testing3 where c2='jones'; +GO +~~START~~ +char +JONES +JoneS +jOnes +~~END~~ + +select c3 from testing3 where c3='jones'; +GO +~~START~~ +nvarchar +JONES +JoneS +jOnes +~~END~~ + + +-- test LIKE to ILIKE transformation +create table testing4 (c1 varchar(20), c2 char(20), c3 nvarchar(20)); +create index c1_idx on testing4 (c1); +GO + +insert into testing4 values ('JONES','JONES','JONES'); +insert into testing4 values ('JoneS','JoneS','JoneS'); +insert into testing4 values ('jOnes','jOnes','jOnes'); +insert into testing4 values ('abcD','AbcD','ABCd'); +insert into testing4 values ('äbĆD','äḃcD','äƀCd'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- set enable_seqscan doesn't work from the TSQL dialect, so switch +-- dialects, disable sequential scan so we see some index-based plans, +-- then switch back to the TSQL dialect +-- +select set_config('enable_seqscan','off','false'); +GO +~~START~~ +text +off +~~END~~ + + + +SET babelfish_showplan_all ON; +GO +-- test that like is case-insenstive +select c1 from testing4 where c1 LIKE 'jones'; -- this gets converted to '=' +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE 'jones' +Gather (cost=11.40..24.02 rows=3 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..24.02 rows=1 width=32) + Filter: ((c1)::text = 'jones'::text COLLATE "default") + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +select c1 from testing4 where c1 LIKE 'Jon%'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE 'Jon%' +Gather (cost=11.40..25.07 rows=1 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..25.07 rows=1 width=32) + Filter: (((c1)::text ~~* 'Jon%'::text COLLATE "default") AND ((c1)::text >= 'Jon'::text COLLATE "default") AND ((c1)::text < 'Jon?'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +select c1 from testing4 where c1 LIKE 'jone_'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE 'jone_' +Gather (cost=11.40..25.07 rows=1 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..25.07 rows=1 width=32) + Filter: (((c1)::text ~~* 'jone_'::text COLLATE "default") AND ((c1)::text >= 'jone'::text COLLATE "default") AND ((c1)::text < 'jone?'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +select c1 from testing4 where c1 LIKE '_one_'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE '_one_' +Gather (cost=11.40..24.02 rows=5 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..24.02 rows=2 width=32) + Filter: ((c1)::text ~~* '_one_'::text COLLATE "default") + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +select c1 from testing4 where c1 LIKE '%on%s'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE '%on%s' +Gather (cost=11.41..24.03 rows=26 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.41..24.03 rows=8 width=32) + Filter: ((c1)::text ~~* '%on%s'::text COLLATE "default") + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +-- test that like is accent-senstive for CI_AS collation +select c1 from testing4 where c1 LIKE 'ab%'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE 'ab%' +Gather (cost=11.40..25.07 rows=1 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..25.07 rows=1 width=32) + Filter: (((c1)::text ~~* 'ab%'::text COLLATE "default") AND ((c1)::text >= 'ab'::text COLLATE "default") AND ((c1)::text < 'ab?'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + +select c1 from testing4 where c1 LIKE 'äb%'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE 'äb%' +Gather (cost=11.40..25.07 rows=1 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..25.07 rows=1 width=32) + Filter: (((c1)::text ~~* 'äb%'::text COLLATE "default") AND ((c1)::text >= 'äb'::text COLLATE "default") AND ((c1)::text < 'äb?'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + +select c1 from testing4 where c1 LIKE 'äḃĆ_'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE 'ä??_' +Gather (cost=11.40..25.07 rows=1 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..25.07 rows=1 width=32) + Filter: (((c1)::text ~~* 'ä??_'::text COLLATE "default") AND ((c1)::text >= 'ä??'::text COLLATE "default") AND ((c1)::text < 'ä???'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +-- test not like +select c1 from testing4 where c1 NOT LIKE 'jones'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 NOT LIKE 'jones' +Gather (cost=11.56..24.18 rows=647 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.56..24.18 rows=209 width=32) + Filter: ((c1)::text <> 'jones'::text COLLATE "default") + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +select c1 from testing4 where c1 NOT LIKE 'jone%'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 NOT LIKE 'jone%' +Gather (cost=11.56..25.23 rows=648 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.56..25.23 rows=209 width=32) + Filter: (((c1)::text !~~* 'jone%'::text COLLATE "default") OR ((c1)::text < 'jone'::text COLLATE "default") OR ((c1)::text >= 'jone?'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +select c1 from testing4 where c1 NOT LIKE 'ä%'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 NOT LIKE 'ä%' +Gather (cost=11.55..25.22 rows=592 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.55..25.22 rows=191 width=32) + Filter: (((c1)::text !~~* 'ä%'::text COLLATE "default") OR ((c1)::text < 'ä'::text COLLATE "default") OR ((c1)::text >= 'ä?'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + + +-- wild card literals are transformed to equal +select c1 from testing4 where c1 LIKE '\%ones'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE '\%ones' +Gather (cost=11.40..25.07 rows=1 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..25.07 rows=1 width=32) + Filter: (((c1)::text ~~* '\%ones'::text COLLATE "default") AND ((c1)::text >= '\'::text COLLATE "default") AND ((c1)::text < '\?'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +select c1 from testing4 where c1 LIKE '\_ones'; +GO +~~START~~ +text +Query Text: select c1 from testing4 where c1 LIKE '\_ones' +Gather (cost=11.40..25.07 rows=1 width=32) + Workers Planned: 3 + -> Parallel Bitmap Heap Scan on testing4 (cost=11.40..25.07 rows=1 width=32) + Filter: (((c1)::text ~~* '\_ones'::text COLLATE "default") AND ((c1)::text >= '\'::text COLLATE "default") AND ((c1)::text < '\?'::text)) + -> Bitmap Index Scan on c1_idxtesting49a168d73f3ba5aacdfd495b931b8d187 (cost=0.00..11.40 rows=650 width=0) +~~END~~ + + +SET babelfish_showplan_all OFF; +GO +-- test combining with other string functions +select c1 from testing4 where c1 LIKE lower('_ones'); +GO +~~START~~ +varchar +JONES +JoneS +jOnes +~~END~~ + +select c1 from testing4 where c1 LIKE upper('_ones'); +GO +~~START~~ +varchar +JONES +JoneS +jOnes +~~END~~ + +select c1 from testing4 where c1 LIKE concat('_on','_s'); +GO +~~START~~ +varchar +JONES +JoneS +jOnes +~~END~~ + +select c1 from testing4 where c1 LIKE concat('a','%d'); +GO +~~START~~ +varchar +abcD +~~END~~ + +select c1 from testing4 where c1 NOT LIKE lower('%s'); +GO +~~START~~ +varchar +abcD +äb?D +~~END~~ + +-- test sub-queries +Select * from testing4 where c1 LIKE (select c1 from testing4 where c1 LIKE 'AbcD'); +GO +~~START~~ +varchar#!#char#!#nvarchar +abcD#!#AbcD #!#ABCd +~~END~~ + +Select * from testing4 where c2 NOT LIKE (select c2 from testing4 where c2 NOT LIKE 'jo%' AND c2 NOT LIKE 'ä%'); +GO +~~START~~ +varchar#!#char#!#nvarchar +JONES#!#JONES #!#JONES +JoneS#!#JoneS #!#JoneS +jOnes#!#jOnes #!#jOnes +äb?D#!#ä?cD #!#äƀCd +~~END~~ + +Select * from testing4 where c3 LIKE (select c3 from testing4 where c3 NOT LIKE'jo%' AND c3 NOT LIKE 'ä%'); +GO +~~START~~ +varchar#!#char#!#nvarchar +abcD#!#AbcD #!#ABCd +~~END~~ + +with p1 as (select c1 from testing4 where c1 LIKE '__Ć_'), +p2 as (select c3 from testing4 where c3 LIKE 'äƀ__') +select * from p1 union all select * from p2; +GO +~~START~~ +nvarchar +äbĆD +äƀCd +~~END~~ + +-- test case expression +select c2,(case when c2 LIKE '_bc%' then 1 when c2 LIKE 'jon%' then 2 when c3 LIKE 'ä%' then 3 end) from testing4; +GO +~~START~~ +char#!#int +JONES #!#2 +JoneS #!#2 +jOnes #!#2 +AbcD #!#1 +ä?cD #!#3 +~~END~~ + +-- test that LIKE transformation is applied only for CI_AS column +create table testing5(c1 varchar(20) COLLATE SQL_Latin1_General_CP1_CS_AS); +GO +insert into testing5 values ('JONES'); +insert into testing5 values ('JoneS'); +insert into testing5 values ('abcD'); +insert into testing5 values ('äbĆD'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +select * from testing5 where c1 LIKE 'jo%'; -- does not use the transformation +GO +~~START~~ +varchar +~~END~~ + +SET babelfish_showplan_all ON; +GO +select * from testing5 where c1 LIKE 'jo%'; +GO +~~START~~ +text +Query Text: select * from testing5 where c1 LIKE 'jo%' +Gather (cost=10000000000.00..10000000027.00 rows=7 width=32) + Workers Planned: 1 + Single Copy: true + -> Seq Scan on testing5 (cost=10000000000.00..10000000027.00 rows=7 width=32) + Filter: ((c1)::text ~~ 'jo%'::text COLLATE "default") +~~END~~ + +SET babelfish_showplan_all OFF; +GO +select * from testing5 where c1 NOT LIKE 'j%'; +GO +~~START~~ +varchar +JONES +JoneS +abcD +äb?D +~~END~~ + +select * from testing5 where c1 LIKE 'AB%'; +GO +~~START~~ +varchar +~~END~~ + + +SELECT * from testing5 where c1 like ''; +GO +~~START~~ +varchar +~~END~~ + +SET babelfish_showplan_all ON; +GO +SELECT * from testing5 where c1 like ''; +GO +~~START~~ +text +Query Text: SELECT * from testing5 where c1 like '' +Gather (cost=10000000000.00..10000000027.00 rows=7 width=32) + Workers Planned: 1 + Single Copy: true + -> Seq Scan on testing5 (cost=10000000000.00..10000000027.00 rows=7 width=32) + Filter: ((c1)::text ~~ ''::text COLLATE "default") +~~END~~ + +SET babelfish_showplan_all OFF; +GO +SELECT * from testing5 where c1 like NULL; +GO +~~START~~ +varchar +~~END~~ + +SET babelfish_showplan_all ON; +GO +SELECT * from testing5 where c1 like NULL; +GO +~~START~~ +text +Query Text: SELECT * from testing5 where c1 like NULL +Gather (cost=0.00..0.00 rows=0 width=0) + Workers Planned: 1 + Single Copy: true + -> Result (cost=0.00..0.00 rows=0 width=0) + One-Time Filter: false +~~END~~ + +SET babelfish_showplan_all OFF; +GO + +SELECT * FROM testing5 where c1 COLLATE French_CI_AS like 'jo%' ; +GO +~~START~~ +varchar +JONES +JoneS +~~END~~ + +SET babelfish_showplan_all ON; +GO +SELECT * FROM testing5 where c1 COLLATE French_CI_AS like 'jo%' ; +GO +~~START~~ +text +Query Text: SELECT * FROM testing5 where c1 COLLATE French_CI_AS like 'jo%' +Gather (cost=10000000000.00..10000000033.80 rows=1 width=32) + Workers Planned: 1 + Single Copy: true + -> Seq Scan on testing5 (cost=10000000000.00..10000000033.80 rows=1 width=32) + Filter: (((c1)::text ~~* 'jo%'::text COLLATE "default") AND ((c1)::text >= 'jo'::text COLLATE "default") AND ((c1)::text < 'jo?'::text)) +~~END~~ + +SET babelfish_showplan_all OFF; +GO +SELECT * FROM testing5 where c1 COLLATE Chinese_PRC_CI_AS like 'jo%' ; +GO +~~START~~ +varchar +JONES +JoneS +~~END~~ + +SET babelfish_showplan_all ON; +GO +SELECT * FROM testing5 where c1 COLLATE Chinese_PRC_CI_AS like 'jo%' ; +GO +~~START~~ +text +Query Text: SELECT * FROM testing5 where c1 COLLATE Chinese_PRC_CI_AS like 'jo%' +Gather (cost=10000000000.00..10000000033.80 rows=1 width=32) + Workers Planned: 1 + Single Copy: true + -> Seq Scan on testing5 (cost=10000000000.00..10000000033.80 rows=1 width=32) + Filter: (((c1)::text ~~* 'jo%'::text COLLATE "default") AND ((c1)::text >= 'jo'::text COLLATE "default") AND ((c1)::text < 'jo?'::text)) +~~END~~ + +SET babelfish_showplan_all OFF; +GO + +-- expect different result order from previous select +select * from testing1 order by col; +GO +~~START~~ +nvarchar +Magic +Muffler +Mülle +MX Systems +~~END~~ + +-- test expression level collate, expect the same result order +select * from testing1 order by col collate Finnish_Swedish_CS_AS; +GO +~~START~~ +nvarchar +Magic +Muffler +MX Systems +Mülle +~~END~~ + +-- test catalog +select * from sys.fn_helpcollations() order by name; +GO +~~START~~ +varchar#!#varchar +arabic_ci_ai#!#Arabic, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +arabic_ci_as#!#Arabic, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +arabic_cs_as#!#Arabic, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_bin2#!#Unicode-General, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1250_ci_ai#!#Default locale, code page 1250, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1250_ci_as#!#Default locale, code page 1250, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1250_cs_ai#!#Default locale, code page 1250, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1250_cs_as#!#Default locale, code page 1250, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1251_ci_ai#!#Default locale, code page 1251, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1251_ci_as#!#Default locale, code page 1251, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1251_cs_ai#!#Default locale, code page 1251, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1251_cs_as#!#Default locale, code page 1251, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1253_ci_ai#!#Default locale, code page 1253, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1253_ci_as#!#Default locale, code page 1253, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1253_cs_ai#!#Default locale, code page 1253, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1253_cs_as#!#Default locale, code page 1253, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1254_ci_ai#!#Default locale, code page 1254, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1254_ci_as#!#Default locale, code page 1254, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1254_cs_ai#!#Default locale, code page 1254, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1254_cs_as#!#Default locale, code page 1254, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1255_ci_ai#!#Default locale, code page 1255, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1255_ci_as#!#Default locale, code page 1255, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1255_cs_ai#!#Default locale, code page 1255, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1255_cs_as#!#Default locale, code page 1255, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1256_ci_ai#!#Default locale, code page 1256, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1256_ci_as#!#Default locale, code page 1256, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1256_cs_ai#!#Default locale, code page 1256, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1256_cs_as#!#Default locale, code page 1256, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1257_ci_ai#!#Default locale, code page 1257, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1257_ci_as#!#Default locale, code page 1257, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1257_cs_ai#!#Default locale, code page 1257, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1257_cs_as#!#Default locale, code page 1257, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1258_ci_ai#!#Default locale, code page 1258, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1258_ci_as#!#Default locale, code page 1258, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1258_cs_ai#!#Default locale, code page 1258, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1258_cs_as#!#Default locale, code page 1258, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1_ci_ai#!#Default locale, code page 1252, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1_ci_as#!#Default locale, code page 1252, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1_cs_ai#!#Default locale, code page 1252, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp1_cs_as#!#Default locale, code page 1252, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp847_ci_ai#!#Default locale, code page 847, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp847_ci_as#!#Default locale, code page 847, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp847_cs_ai#!#Default locale, code page 847, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_cp847_cs_as#!#Default locale, code page 847, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_general_ci_ai#!#Default locale, default code page, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_general_ci_as#!#Default locale, default code page, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_general_cs_ai#!#Default locale, default code page, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +bbf_unicode_general_cs_as#!#Default locale, default code page, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +bbf_unicode_general_pref_cs_as#!#Default locale, default code page, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1250_cs_as#!#Default locale, code page 1250, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1251_cs_as#!#Default locale, code page 1251, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1253_cs_as#!#Default locale, code page 1253, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1254_cs_as#!#Default locale, code page 1254, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1255_cs_as#!#Default locale, code page 1255, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1256_cs_as#!#Default locale, code page 1256, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1257_cs_as#!#Default locale, code page 1257, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1258_cs_as#!#Default locale, code page 1258, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp1_cs_as#!#Default locale, code page 1252, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +bbf_unicode_pref_cp847_cs_as#!#Default locale, code page 847, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +chinese_prc_ci_ai#!#Chinese-PRC, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +chinese_prc_ci_as#!#Chinese-PRC, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +chinese_prc_cs_as#!#Chinese-PRC, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +cyrillic_general_ci_ai#!#Cyrillic-General, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +cyrillic_general_ci_as#!#Cyrillic-General, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +cyrillic_general_cs_as#!#Cyrillic-General, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +estonian_ci_ai#!#Estonian, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +estonian_ci_as#!#Estonian, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +estonian_cs_as#!#Estonian, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +finnish_swedish_ci_ai#!#Finnish-Swedish, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +finnish_swedish_ci_as#!#Finnish-Swedish, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +finnish_swedish_cs_as#!#Finnish-Swedish, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +french_ci_ai#!#French, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +french_ci_as#!#French, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +french_cs_as#!#French, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +greek_ci_ai#!#Greek, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +greek_ci_as#!#Greek, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +greek_cs_as#!#Greek, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +hebrew_ci_ai#!#Hebrew, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +hebrew_ci_as#!#Hebrew, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitives +hebrew_cs_as#!#Hebrew, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +japanese_ci_ai#!#Japanese, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +japanese_ci_as#!#Japanese, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +japanese_cs_as#!#Japanese, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +korean_wansung_ci_ai#!#Korean-Wansung, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +korean_wansung_ci_as#!#Korean-Wansung, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +korean_wansung_cs_as#!#Korean-Wansung, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +latin1_general_100_bin2#!#Virtual, Unicode-General, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +latin1_general_140_bin2#!#Virtual, Unicode-General, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +latin1_general_90_bin2#!#Virtual, Unicode-General, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +latin1_general_bin2#!#Virtual, Unicode-General, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +latin1_general_ci_ai#!#Virtual, default locale, code page 1252, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +latin1_general_ci_as#!#Virtual, default locale, code page 1252, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +latin1_general_cs_ai#!#Virtual, default locale, code page 1252, case-sensitive, accent-insensitive, kanatype-insensitive, width-insensitive +latin1_general_cs_as#!#Virtual, default locale, code page 1252, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +modern_spanish_ci_ai#!#Traditional-Spanish, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +modern_spanish_ci_as#!#Traditional-Spanish, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +modern_spanish_cs_as#!#Traditional-Spanish, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +mongolian_ci_ai#!#Mongolian, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +mongolian_ci_as#!#Mongolian, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +mongolian_cs_as#!#Mongolian, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +polish_ci_ai#!#Polish, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +polish_ci_as#!#Polish, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +polish_cs_as#!#Polish, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1250_ci_as#!#Virtual, default locale, code page 1250, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1250_cs_as#!#Virtual, default locale, code page 1250, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1251_ci_as#!#Virtual, default locale, code page 1251, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1251_cs_as#!#Virtual, default locale, code page 1251, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1253_ci_as#!#Virtual, default locale, code page 1253, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1253_cs_as#!#Virtual, default locale, code page 1253, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1254_ci_as#!#Virtual, default locale, code page 1254, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1254_cs_as#!#Virtual, default locale, code page 1255, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1255_ci_as#!#Virtual, default locale, code page 1255, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1255_cs_as#!#Virtual, default locale, code page 1255, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1256_ci_as#!#Virtual, default locale, code page 1256, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1256_cs_as#!#Virtual, default locale, code page 1256, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1257_ci_as#!#Virtual, default locale, code page 1257, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1257_cs_as#!#Virtual, default locale, code page 1257, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1258_ci_as#!#Virtual, default locale, code page 1258, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1258_cs_as#!#Virtual, default locale, code page 1258, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1_ci_ai#!#Virtual, default locale, code page 1252, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1_ci_ai#!#Virtual, default locale, code page 1252, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1_ci_as#!#Virtual, default locale, code page 1252, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp1_cs_as#!#Virtual, default locale, code page 1252, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp874_ci_as#!#Virtual, default locale, code page 874, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_cp874_cs_as#!#Virtual, default locale, code page 874, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +sql_latin1_general_pref_cp1_cs_as#!#Virtual, default locale, code page 1252, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive, uppercase-first +thai_ci_ai#!#Thai, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +thai_ci_as#!#Thai, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +thai_cs_as#!#Thai, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +traditional_spanish_ci_ai#!#Traditional-Spanish, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +traditional_spanish_ci_as#!#Traditional-Spanish, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +traditional_spanish_cs_as#!#Traditional-Spanish, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +turkish_ci_ai#!#Turkish, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +turkish_ci_as#!#Turkish, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +turkish_cs_as#!#Turkish, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +ukrainian_ci_ai#!#Ukrainian, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +ukrainian_ci_as#!#Ukrainian, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +ukrainian_cs_as#!#Ukrainian, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +vietnamese_ci_ai#!#Vietnamese, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive +vietnamese_ci_as#!#Vietnamese, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive +vietnamese_cs_as#!#Vietnamese, case-sensitive, accent-sensitive, kanatype-insensitive, width-insensitive +~~END~~ + + +SELECT set_config('babelfishpg_tsql.sql_dialect', 'tsql', false); +GO +~~START~~ +text +tsql +~~END~~ + +-- test collation list sys table +SELECT collation_name, l1_priority, l2_priority, l3_priority, l4_priority, l5_priority FROM sys.babelfish_collation_list() order by collation_name; +GO +~~START~~ +text#!#int#!#int#!#int#!#int#!#int +arabic_ci_ai#!#1025#!#0#!#196608#!#0#!#15 +arabic_ci_as#!#1025#!#0#!#196608#!#0#!#13 +arabic_cs_as#!#1025#!#0#!#196608#!#0#!#12 +bbf_unicode_bin2#!#1033#!#0#!#196608#!#54#!#544 +bbf_unicode_cp1250_ci_ai#!#1045#!#0#!#196608#!#0#!#15 +bbf_unicode_cp1250_ci_as#!#1045#!#0#!#196608#!#0#!#13 +bbf_unicode_cp1250_cs_ai#!#1045#!#0#!#196608#!#0#!#14 +bbf_unicode_cp1250_cs_as#!#1045#!#0#!#196608#!#0#!#12 +bbf_unicode_cp1251_ci_ai#!#1049#!#0#!#196608#!#0#!#15 +bbf_unicode_cp1251_ci_as#!#1049#!#0#!#196608#!#0#!#13 +bbf_unicode_cp1251_cs_ai#!#1049#!#0#!#196608#!#0#!#14 +bbf_unicode_cp1251_cs_as#!#1049#!#0#!#196608#!#0#!#12 +bbf_unicode_cp1253_ci_ai#!#1032#!#0#!#196608#!#0#!#15 +bbf_unicode_cp1253_ci_as#!#1032#!#0#!#196608#!#0#!#13 +bbf_unicode_cp1253_cs_ai#!#1032#!#0#!#196608#!#0#!#14 +bbf_unicode_cp1253_cs_as#!#1032#!#0#!#196608#!#0#!#12 +bbf_unicode_cp1254_ci_ai#!#1055#!#0#!#196608#!#0#!#15 +bbf_unicode_cp1254_ci_as#!#1055#!#0#!#196608#!#0#!#13 +bbf_unicode_cp1254_cs_ai#!#1055#!#0#!#196608#!#0#!#14 +bbf_unicode_cp1254_cs_as#!#1055#!#0#!#196608#!#0#!#12 +bbf_unicode_cp1255_ci_ai#!#1037#!#0#!#196608#!#0#!#15 +bbf_unicode_cp1255_ci_as#!#1037#!#0#!#196608#!#0#!#13 +bbf_unicode_cp1255_cs_ai#!#1037#!#0#!#196608#!#0#!#14 +bbf_unicode_cp1255_cs_as#!#1037#!#0#!#196608#!#0#!#12 +bbf_unicode_cp1256_ci_ai#!#1025#!#0#!#196608#!#0#!#15 +bbf_unicode_cp1256_ci_as#!#1025#!#0#!#196608#!#0#!#13 +bbf_unicode_cp1256_cs_ai#!#1025#!#0#!#196608#!#0#!#14 +bbf_unicode_cp1256_cs_as#!#1025#!#0#!#196608#!#0#!#12 +bbf_unicode_cp1257_ci_ai#!#1061#!#0#!#196608#!#0#!#15 +bbf_unicode_cp1257_ci_as#!#1061#!#0#!#196608#!#0#!#13 +bbf_unicode_cp1257_cs_ai#!#1061#!#0#!#196608#!#0#!#14 +bbf_unicode_cp1257_cs_as#!#1061#!#0#!#196608#!#0#!#12 +bbf_unicode_cp1258_ci_ai#!#1066#!#0#!#196608#!#0#!#15 +bbf_unicode_cp1258_ci_as#!#1066#!#0#!#196608#!#0#!#13 +bbf_unicode_cp1258_cs_ai#!#1066#!#0#!#196608#!#0#!#14 +bbf_unicode_cp1258_cs_as#!#1066#!#0#!#196608#!#0#!#12 +bbf_unicode_cp1_ci_ai#!#1033#!#0#!#196608#!#54#!#15 +bbf_unicode_cp1_ci_as#!#1033#!#0#!#196608#!#52#!#13 +bbf_unicode_cp1_cs_ai#!#1033#!#0#!#196608#!#51#!#14 +bbf_unicode_cp1_cs_as#!#1033#!#0#!#196608#!#51#!#12 +bbf_unicode_cp874_ci_ai#!#1054#!#0#!#196608#!#0#!#15 +bbf_unicode_cp874_ci_as#!#1054#!#0#!#196608#!#0#!#13 +bbf_unicode_cp874_cs_ai#!#1054#!#0#!#196608#!#0#!#14 +bbf_unicode_cp874_cs_as#!#1054#!#0#!#196608#!#0#!#12 +bbf_unicode_general_ci_ai#!#1033#!#0#!#196608#!#0#!#15 +bbf_unicode_general_ci_as#!#1033#!#0#!#196608#!#0#!#13 +bbf_unicode_general_cs_ai#!#1033#!#0#!#196608#!#0#!#14 +bbf_unicode_general_cs_as#!#1033#!#0#!#196608#!#0#!#12 +bbf_unicode_general_pref_cs_as#!#1033#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1250_cs_as#!#1045#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1251_cs_as#!#1049#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1253_cs_as#!#1032#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1254_cs_as#!#1055#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1255_cs_as#!#1037#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1256_cs_as#!#1025#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1257_cs_as#!#1061#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1258_cs_as#!#1066#!#0#!#196608#!#0#!#12 +bbf_unicode_pref_cp1_cs_as#!#1033#!#0#!#196608#!#51#!#12 +bbf_unicode_pref_cp874_cs_as#!#1054#!#0#!#196608#!#0#!#12 +chinese_prc_ci_ai#!#2052#!#0#!#196608#!#0#!#15 +chinese_prc_ci_as#!#2052#!#0#!#196608#!#0#!#13 +chinese_prc_cs_as#!#2052#!#0#!#196608#!#0#!#12 +cyrillic_general_ci_ai#!#1049#!#0#!#196608#!#0#!#15 +cyrillic_general_ci_as#!#1049#!#0#!#196608#!#0#!#13 +cyrillic_general_cs_as#!#1049#!#0#!#196608#!#0#!#12 +estonian_ci_ai#!#1061#!#0#!#196608#!#0#!#15 +estonian_ci_as#!#1061#!#0#!#196608#!#0#!#13 +estonian_cs_as#!#1061#!#0#!#196608#!#0#!#12 +finnish_swedish_ci_ai#!#1035#!#0#!#196608#!#0#!#15 +finnish_swedish_ci_as#!#1035#!#0#!#196608#!#0#!#13 +finnish_swedish_cs_as#!#1035#!#0#!#196608#!#0#!#12 +french_ci_ai#!#1036#!#0#!#196608#!#0#!#15 +french_ci_as#!#1036#!#0#!#196608#!#0#!#13 +french_cs_as#!#1036#!#0#!#196608#!#0#!#12 +greek_ci_ai#!#1032#!#0#!#196608#!#0#!#15 +greek_ci_as#!#1032#!#0#!#196608#!#0#!#13 +greek_cs_as#!#1032#!#0#!#196608#!#0#!#12 +hebrew_ci_ai#!#1037#!#0#!#196608#!#0#!#15 +hebrew_ci_as#!#1037#!#0#!#196608#!#0#!#13 +hebrew_cs_as#!#1037#!#0#!#196608#!#0#!#12 +japanese_ci_ai#!#1041#!#0#!#196608#!#0#!#15 +japanese_ci_as#!#1041#!#0#!#196608#!#0#!#13 +japanese_cs_as#!#1041#!#0#!#196608#!#0#!#12 +korean_wansung_ci_ai#!#1042#!#0#!#196608#!#0#!#15 +korean_wansung_ci_as#!#1042#!#0#!#196608#!#0#!#13 +korean_wansung_cs_as#!#1042#!#0#!#196608#!#0#!#12 +modern_spanish_ci_ai#!#3082#!#0#!#196608#!#0#!#15 +modern_spanish_ci_as#!#3082#!#0#!#196608#!#0#!#13 +modern_spanish_cs_as#!#3082#!#0#!#196608#!#0#!#12 +mongolian_ci_ai#!#1104#!#0#!#196608#!#0#!#15 +mongolian_ci_as#!#1104#!#0#!#196608#!#0#!#13 +mongolian_cs_as#!#1104#!#0#!#196608#!#0#!#12 +polish_ci_ai#!#1045#!#0#!#196608#!#0#!#15 +polish_ci_as#!#1045#!#0#!#196608#!#0#!#13 +polish_cs_as#!#1045#!#0#!#196608#!#0#!#12 +thai_ci_ai#!#1054#!#0#!#196608#!#0#!#15 +thai_ci_as#!#1054#!#0#!#196608#!#0#!#13 +thai_cs_as#!#1054#!#0#!#196608#!#0#!#12 +traditional_spanish_ci_ai#!#1034#!#0#!#196608#!#0#!#15 +traditional_spanish_ci_as#!#1034#!#0#!#196608#!#0#!#13 +traditional_spanish_cs_as#!#1034#!#0#!#196608#!#0#!#12 +turkish_ci_ai#!#1055#!#0#!#196608#!#0#!#15 +turkish_ci_as#!#1055#!#0#!#196608#!#0#!#13 +turkish_cs_as#!#1055#!#0#!#196608#!#0#!#12 +ukrainian_ci_ai#!#1058#!#0#!#196608#!#0#!#15 +ukrainian_ci_as#!#1058#!#0#!#196608#!#0#!#13 +ukrainian_cs_as#!#1058#!#0#!#196608#!#0#!#12 +vietnamese_ci_ai#!#1066#!#0#!#196608#!#0#!#15 +vietnamese_ci_as#!#1066#!#0#!#196608#!#0#!#13 +vietnamese_cs_as#!#1066#!#0#!#196608#!#0#!#12 +~~END~~ + +-- clean up +drop table testing1; +GO +drop table testing2; +GO +drop table testing3; +GO +drop table testing4; +GO +drop table testing5; +GO diff --git a/test/JDBC/expected/parallel_query/binary-index-vu-verify.out b/test/JDBC/expected/parallel_query/binary-index-vu-verify.out new file mode 100644 index 0000000000..062193bfff --- /dev/null +++ b/test/JDBC/expected/parallel_query/binary-index-vu-verify.out @@ -0,0 +1,156 @@ +select set_config('enable_bitmapscan', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +exec babel_3939_vu_prepare_p1; +GO +~~START~~ +binary#!#int +BAADF00D#!#1234 +~~END~~ + +~~START~~ +binary#!#int +BAADF00D#!#1234 +~~END~~ + +~~START~~ +binary#!#int +BAADF00D#!#1234 +~~END~~ + +~~START~~ +int +10000 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +10001 +~~END~~ + +~~START~~ +int +1 +~~END~~ + + +exec sp_babelfish_configure 'explain_costs', 'off'; +GO + +SET BABELFISH_SHOWPLAN_ALL ON; +GO + + + +exec babel_3939_vu_prepare_p1; +GO +~~START~~ +text +Query Text: EXEC babel_3939_vu_prepare_p1 + Query Text: select * from tab_binary where a = 0xBAADF00D + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_binary + Filter: ((a)::bbf_binary = '0xbaadf00d'::bbf_varbinary) + Query Text: select * from tab_binary where a = cast (0xBAADF00D as binary ) + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_binary + Filter: ((a)::bbf_binary = '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_binary) + Query Text: select * from tab_binary where a = 0xBAADF00D + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_binary + Filter: ((a)::bbf_binary = '0xbaadf00d'::bbf_varbinary) + Query Text: select count(*) from tab_binary where a > 0xBAADF00D + -> Finalize Aggregate + -> Gather + Workers Planned: 4 + -> Partial Aggregate + -> Parallel Seq Scan on tab_binary + Filter: ((a)::bbf_varbinary > '0xbaadf00d'::bbf_varbinary) + Query Text: select count(*) from tab_binary where a < 0xBAADF00D + -> Finalize Aggregate + -> Gather + Workers Planned: 4 + -> Partial Aggregate + -> Parallel Seq Scan on tab_binary + Filter: ((a)::bbf_varbinary < '0xbaadf00d'::bbf_varbinary) + Query Text: select count(*) from tab_binary where a >= 0xBAADF00D + -> Finalize Aggregate + -> Gather + Workers Planned: 4 + -> Partial Aggregate + -> Parallel Seq Scan on tab_binary + Filter: ((a)::bbf_varbinary >= '0xbaadf00d'::bbf_varbinary) + Query Text: select count(*) from tab_binary where a <= 0xBAADF00D + -> Finalize Aggregate + -> Gather + Workers Planned: 4 + -> Partial Aggregate + -> Parallel Seq Scan on tab_binary + Filter: ((a)::bbf_varbinary <= '0xbaadf00d'::bbf_varbinary) +~~END~~ + + +exec babel_3939_vu_prepare_p2; +GO +~~START~~ +text +Query Text: EXEC babel_3939_vu_prepare_p2 + Query Text: select * from tab_varbinary where a = 0xBAADF00D + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_varbinary + Filter: ((a)::bbf_varbinary = '0xbaadf00d'::bbf_varbinary) + Query Text: select * from tab_varbinary where a = cast(0xBAADF00D as binary ) + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_varbinary + Filter: ((a)::bbf_varbinary = '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_binary) + Query Text: select * from tab_varbinary where a > cast(0xBAADF00D as binary ) + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_varbinary + Filter: ((a)::bbf_varbinary > '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_varbinary) + Query Text: select * from tab_varbinary where a < cast(0xBAADF00D as binary ) + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_varbinary + Filter: ((a)::bbf_varbinary < '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_varbinary) + Query Text: select * from tab_varbinary where a >= cast(0xBAADF00D as binary ) + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_varbinary + Filter: ((a)::bbf_varbinary >= '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_varbinary) + Query Text: select * from tab_varbinary where a <= cast(0xBAADF00D as binary ) + -> Gather + Workers Planned: 4 + -> Parallel Seq Scan on tab_varbinary + Filter: ((a)::bbf_varbinary <= '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_varbinary) +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL OFF; +GO + +select set_config('enable_bitmapscan', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +exec sp_babelfish_configure 'explain_costs', 'on'; +GO diff --git a/test/JDBC/input/BABEL-1444.sql b/test/JDBC/input/BABEL-1444.sql index 5ab60ceaa6..fb01730801 100644 --- a/test/JDBC/input/BABEL-1444.sql +++ b/test/JDBC/input/BABEL-1444.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected USE MASTER; GO diff --git a/test/JDBC/input/BABEL-2514.sql b/test/JDBC/input/BABEL-2514.sql index be70b586f4..af63afd80d 100644 --- a/test/JDBC/input/BABEL-2514.sql +++ b/test/JDBC/input/BABEL-2514.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected USE master; go diff --git a/test/JDBC/input/BABEL-2843.sql b/test/JDBC/input/BABEL-2843.sql index 50b400a1b4..d13adb3007 100644 --- a/test/JDBC/input/BABEL-2843.sql +++ b/test/JDBC/input/BABEL-2843.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected use master; go select set_config('babelfishpg_tsql.explain_timing', 'off', false); diff --git a/test/JDBC/input/BABEL-2844.sql b/test/JDBC/input/BABEL-2844.sql index 97d586ce66..88a28c6b15 100644 --- a/test/JDBC/input/BABEL-2844.sql +++ b/test/JDBC/input/BABEL-2844.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected use master; go diff --git a/test/JDBC/input/BABEL-2902.mix b/test/JDBC/input/BABEL-2902.mix index 1e365deaf2..c1e58ce73c 100644 --- a/test/JDBC/input/BABEL-2902.mix +++ b/test/JDBC/input/BABEL-2902.mix @@ -1,4 +1,4 @@ - +-- parallel_query_expected -- Test setup -- -- psql ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'multi-db'; diff --git a/test/JDBC/input/BABEL-2903.sql b/test/JDBC/input/BABEL-2903.sql index d2b3b748ad..3ca9c610be 100644 --- a/test/JDBC/input/BABEL-2903.sql +++ b/test/JDBC/input/BABEL-2903.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected use master; go diff --git a/test/JDBC/input/BABEL-2998.mix b/test/JDBC/input/BABEL-2998.mix index da198506d4..bd27048dad 100644 --- a/test/JDBC/input/BABEL-2998.mix +++ b/test/JDBC/input/BABEL-2998.mix @@ -1,3 +1,4 @@ +-- parallel_query_expected -- tsql -- typmod associated with NULL will be -1 so this will throw an error SELECT CAST('1' AS CHAR(10)) AS Col1 diff --git a/test/JDBC/input/BABEL-3248.sql b/test/JDBC/input/BABEL-3248.sql index f89c15dfb1..19257131d8 100644 --- a/test/JDBC/input/BABEL-3248.sql +++ b/test/JDBC/input/BABEL-3248.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected select set_config('babelfishpg_tsql.explain_costs', 'off', false); go select set_config('babelfishpg_tsql.explain_timing', 'off', false); diff --git a/test/JDBC/input/BABEL-328-vu-verify.sql b/test/JDBC/input/BABEL-328-vu-verify.sql index 844637f318..f58e8cd99a 100644 --- a/test/JDBC/input/BABEL-328-vu-verify.sql +++ b/test/JDBC/input/BABEL-328-vu-verify.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected SELECT * FROM babel_328_vu_v1 GO diff --git a/test/JDBC/input/BABEL-4281.sql b/test/JDBC/input/BABEL-4281.sql index ebe4528096..17617ae913 100644 --- a/test/JDBC/input/BABEL-4281.sql +++ b/test/JDBC/input/BABEL-4281.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected BEGIN TRAN BABEL4281_T1; GO diff --git a/test/JDBC/input/binary-index-vu-verify.sql b/test/JDBC/input/binary-index-vu-verify.sql index 326fb300e2..3298bdb8d1 100644 --- a/test/JDBC/input/binary-index-vu-verify.sql +++ b/test/JDBC/input/binary-index-vu-verify.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected select set_config('enable_bitmapscan', 'off', false); GO diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3295.sql b/test/JDBC/input/pg_hint_plan/BABEL-3295.sql index 30fcce63bd..bb77ea1335 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3295.sql +++ b/test/JDBC/input/pg_hint_plan/BABEL-3295.sql @@ -1,3 +1,4 @@ +-- parallel_query_expected drop table if exists babel_3295_t1 go diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix b/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix index 2c2a4891ed..0394e43bf6 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix @@ -1,3 +1,4 @@ +-- parallel_query_expected -- tsql CREATE TABLE babel_3513_t1(a1 int PRIMARY KEY, b1 int, c1 int) GO diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-verify.mix b/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-verify.mix index 610c022add..988c928f56 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-verify.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-verify.mix @@ -1,3 +1,4 @@ +-- parallel_query_expected -- psql analyze master_dbo.babel_3513_t1; go diff --git a/test/JDBC/input/sqlBatch/TestSQLQueries.txt b/test/JDBC/input/sqlBatch/TestSQLQueries.txt index 8b7e65c1fc..e9b53ce887 100644 --- a/test/JDBC/input/sqlBatch/TestSQLQueries.txt +++ b/test/JDBC/input/sqlBatch/TestSQLQueries.txt @@ -1,3 +1,4 @@ +-- parallel_query_expected #1 CREATE TABLE with primary and unique keyword EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_unique_constraint', 'ignore'; CREATE TABLE tmp(a int PRIMARY KEY, b int UNIQUE); diff --git a/test/JDBC/parallel_query_jdbc_schedule b/test/JDBC/parallel_query_jdbc_schedule index bff6a6e077..2916bbfdf5 100644 --- a/test/JDBC/parallel_query_jdbc_schedule +++ b/test/JDBC/parallel_query_jdbc_schedule @@ -15,36 +15,7 @@ ignore#!#Test-sp_droprolemember-vu-verify ignore#!#Test-sp_droprolemember-vu-cleanup ignore#!#babel_datatype_sqlvariant-vu-verify -# Group 2: Need ORDER BY -ignore#!#BABEL-2514 -ignore#!#BABEL-2998 -ignore#!#BABEL-328-vu-verify -ignore#!#TestSQLQueries - -# Query plan change (needs verification) -ignore#!#BABEL-1363 -ignore#!#BABEL-2843 -ignore#!#BABEL-2844 -ignore#!#BABEL-2902 -ignore#!#BABEL-2903 -ignore#!#BABEL-3248 -ignore#!#BABEL-3295 -ignore#!#BABEL-3513-vu-prepare -ignore#!#BABEL-3513-vu-verify -ignore#!#BABEL-4281 -ignore#!#babel_collection -ignore#!#binary-index-vu-verify -ignore#!#pgr_select_into -ignore#!#cast_eliminate-vu-verify - -# Query plan change (verified) -# Need to design a way to allow expected parallel mode output to be accepted -ignore#!#babel_index_nulls_order-vu-verify -# Query Plan changed. (verified) -ignore#!#BABEL-4264 -ignore#!#table-variable-vu-prepare ignore#!#table-variable-vu-verify -ignore#!#table-variable-vu-cleanup # Other or mixed issues - JIRA-BABEL-4538 # database "" does not exists. (calls is_member() functions) @@ -57,9 +28,6 @@ ignore#!#BABEL-2833 ignore#!#BABEL-ROLE-MEMBER-vu-verify ignore#!#BABEL-ROLE-MEMBER -# current_setting('role') returns NULL. -ignore#!#BABEL-1444 - # JIRA - BABEL-4419 ignore#!#BABEL-1056 ignore#!#BABEL-GUC-PLAN @@ -73,6 +41,9 @@ ignore#!#Test-sp_addrolemember-dep-vu-verify ignore#!#Test-sp_droprolemember-dep-vu-verify ignore#!#babel_table_type +# These test should not ger run in parallel query +ignore#!#BABEL-1363 + # Taking too much time to complete. (TIME-OUT FAILURES) ignore#!#BABEL-SP_TABLE_PRIVILIGES-vu-verify ignore#!#BABEL-SP_COLUMNS_MANAGED-dep-vu-verify