From 45bc806a42d08e312409b67c16131de9bcb67925 Mon Sep 17 00:00:00 2001 From: Anju Bharti <66729219+anju15bharti@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:45:58 +0530 Subject: [PATCH] Remove GUC for setting migration mode for BABEL-4279 and test_search_path testfiles (#3185) As part of #3096, we ignored these files to revisit the migration mode testing. With this commit we have: 1. Removed GUC for setting migration mode to multi-db for BABEL-4279 and test_search_path testfiles. 2. Separated BABEL-4279 testfile for single-db and multi-db migration mode. Signed-off-by: ANJU BHARTI --- test/JDBC/expected/BABEL-4279.out | 46 -- .../chinese_prc_ci_as/test_search_path.out | 45 -- test/JDBC/expected/single_db/BABEL-4279.out | 412 ++++++++++++++++++ test/JDBC/expected/test_search_path.out | 45 -- test/JDBC/input/BABEL-4279.mix | 25 +- test/JDBC/input/test_search_path.sql | 23 - test/JDBC/jdbc_schedule | 2 - test/JDBC/singledb_jdbc_schedule | 1 + 8 files changed, 414 insertions(+), 185 deletions(-) create mode 100644 test/JDBC/expected/single_db/BABEL-4279.out diff --git a/test/JDBC/expected/BABEL-4279.out b/test/JDBC/expected/BABEL-4279.out index 800323c753..789809b439 100644 --- a/test/JDBC/expected/BABEL-4279.out +++ b/test/JDBC/expected/BABEL-4279.out @@ -1,27 +1,3 @@ --- tsql -CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) -GO -INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') -GO -~~ROW COUNT: 1~~ - - --- test multi-db mode -SELECT set_config('role', 'jdbc_user', false); -GO -~~START~~ -text -jdbc_user -~~END~~ - -SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); -GO -~~START~~ -text -multi-db -~~END~~ - - -- tsql CREATE TABLE test_babel_4279_t1([ABC.nfds] INT, [DEf.j] INT); GO @@ -434,25 +410,3 @@ GO DROP TABLE t3 GO - -SELECT set_config('role', 'jdbc_user', false); -GO -~~START~~ -text -jdbc_user -~~END~~ - - --- Reset migration mode to default -DECLARE @mig_mode VARCHAR(10) -SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) -SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END -GO -~~START~~ -int -1 -~~END~~ - - -Drop Table IF EXISTS babelfish_migration_mode_table -GO diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/test_search_path.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/test_search_path.out index 062cda7f41..2d789c084a 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/test_search_path.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/test_search_path.out @@ -1,26 +1,3 @@ -CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) -GO -INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') -GO -~~ROW COUNT: 1~~ - - --- test multi-db mode -SELECT set_config('role', 'jdbc_user', false); -GO -~~START~~ -text -jdbc_user -~~END~~ - -SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); -GO -~~START~~ -text -multi-db -~~END~~ - - -- check if correct schema is present in search path CREATE DATABASE ["BABEL_5111.db"] GO @@ -355,25 +332,3 @@ GO DROP DATABASE ["龙漫远; 龍漫遠.¢£€¥"] GO - -SELECT set_config('role', 'jdbc_user', false); -GO -~~START~~ -text -jdbc_user -~~END~~ - - --- Reset migration mode to default -DECLARE @mig_mode VARCHAR(10) -SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) -SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END -GO -~~START~~ -int -1 -~~END~~ - - -Drop Table IF EXISTS babelfish_migration_mode_table -GO diff --git a/test/JDBC/expected/single_db/BABEL-4279.out b/test/JDBC/expected/single_db/BABEL-4279.out new file mode 100644 index 0000000000..bd06671134 --- /dev/null +++ b/test/JDBC/expected/single_db/BABEL-4279.out @@ -0,0 +1,412 @@ +-- tsql +CREATE TABLE test_babel_4279_t1([ABC.nfds] INT, [DEf.j] INT); +GO + +CREATE VIEW test_babel_4279_v1 AS SELECT test_babel_4279_t1.[ABC.nfds] from test_babel_4279_t1; +GO + +CREATE VIEW test_babel_4279_v2 AS SELECT [test_babel_4279_t1].[ABC.nfds] ,test_babel_4279_t1.[DEf.j] from test_babel_4279_t1; +GO + +CREATE DATABASE ["test_babel_4279_d.1"]; +GO + +USE ["test_babel_4279_d.1"]; +GO + +CREATE SCHEMA test_babel_4279_s1; +GO + +CREATE TABLE test_babel_4279_s1.test_babel_4279_st1([ABC.nfds] INT, [DEf.j] INT); +GO + +CREATE VIEW test_babel_4279_sv1 AS SELECT [test_babel_4279_s1].[test_babel_4279_st1].[ABC.nfds] from test_babel_4279_s1.test_babel_4279_st1; +GO + +USE MASTER +GO + +CREATE VIEW test_babel_4279_v3 AS SELECT ["test_babel_4279_d.1"].[test_babel_4279_s1].[test_babel_4279_st1].[ABC.nfds] from ["test_babel_4279_d.1"].[test_babel_4279_s1].[test_babel_4279_st1]; +GO + +CREATE TABLE test_babel_4279_t2(您您对您对您对您对您对您对您对您对您对您您您 INT, 对您对您对您对您对您对您对您 INT); +GO + +CREATE VIEW test_babel_4279_v4 AS SELECT test_babel_4279_t2.[您您对您对您对您对您对您对您对您对您对您您您] from test_babel_4279_t2; +GO + +CREATE VIEW test_babel_4279_v5 AS SELECT ぁあ.[您您对您对您对您对您对您对您对您对您对您您您] from test_babel_4279_t2 AS ぁあ; +GO + +CREATE SCHEMA "tngdf'"; +GO + +CREATE TABLE "tngdf'".[sc,sdg"fdsngjds']("AB[C" INT); +GO + +CREATE VIEW test_babel_4279_v6 AS SELECT "tngdf'".[sc,sdg"fdsngjds']."AB[C" from "tngdf'".[sc,sdg"fdsngjds']; +GO + +CREATE TABLE test_babel_4279_t3(ABCD INT); +GO + +CREATE VIEW test_babel_4279_v7 AS SELECT test_babel_4279_t3.ABCD FROM test_babel_4279_t3; +GO + +CREATE TABLE test_babel_4279_t4([ぁあ'"] INT); +GO + +CREATE VIEW test_babel_4279_v8 AS SELECT test_babel_4279_t4.[ぁあ'"] FROM test_babel_4279_t4; +GO + +-- psql +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v1'; +GO +~~START~~ +text + SELECT "abc.nfds" AS "ABC.nfds" FROM master_dbo.test_babel_4279_t1; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v2'; +GO +~~START~~ +text + SELECT "abc.nfds" AS "ABC.nfds", "def.j" AS "DEf.j" FROM master_dbo.test_babel_4279_t1; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_sv1'; +GO +~~START~~ +text + SELECT "abc.nfds" AS "ABC.nfds" FROM test_babel_4279_s1.test_babel_4279_st1; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v3'; +GO +~~START~~ +text + SELECT "abc.nfds" AS "ABC.nfds" FROM test_babel_4279_s1.test_babel_4279_st1; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v4'; +GO +~~START~~ +text + SELECT "您您对您对您对您对您d60211ff7d947ff09db87babbf0cb9de" FROM master_dbo.test_babel_4279_t2; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v5'; +GO +~~START~~ +text + SELECT "您您对您对您对您对您d60211ff7d947ff09db87babbf0cb9de" FROM master_dbo.test_babel_4279_t2 "ぁあ"; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v6'; +GO +~~START~~ +text + SELECT "ab[c" AS "AB[C" FROM "master_tngdf'"."sc,sdg""fdsngjds'"; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v7'; +GO +~~START~~ +text + SELECT abcd AS "ABCD" FROM master_dbo.test_babel_4279_t3; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v8'; +GO +~~START~~ +text + SELECT "ぁあ'""" FROM master_dbo.test_babel_4279_t4; +~~END~~ + + +-- tsql +DROP VIEW test_babel_4279_v3; +GO + +USE ["test_babel_4279_d.1"]; +GO + +DROP VIEW test_babel_4279_sv1; +GO + +DROP TABLE test_babel_4279_s1.test_babel_4279_st1; +GO + +DROP SCHEMA test_babel_4279_s1; +GO + +USE MASTER; +GO + +DROP VIEW test_babel_4279_v4; +GO + +DROP VIEW test_babel_4279_v5; +GO + +DROP TABLE test_babel_4279_t2; +GO + +DROP VIEW test_babel_4279_v6; +GO + +DROP TABLE "tngdf'".[sc,sdg"fdsngjds']; +GO + +DROP SCHEMA "tngdf'"; +GO + +DROP VIEW test_babel_4279_v7; +GO + +DROP TABLE test_babel_4279_t3; +GO + +DROP VIEW test_babel_4279_v8; +GO + +DROP TABLE test_babel_4279_t4; +GO + +DROP DATABASE ["test_babel_4279_d.1"]; +GO + +CREATE DATABASE ["test_babel_4279_d.1"] COLLATE BBF_Unicode_CP1_CI_AI; +GO + +USE ["test_babel_4279_d.1"]; +GO + +CREATE SCHEMA test_babel_4279_s1; +GO + +CREATE TABLE test_babel_4279_s1.test_babel_4279_st1([ABC.nfds] INT, [DEf.j] INT); +GO + +CREATE VIEW test_babel_4279_sv1 AS SELECT [test_babel_4279_s1].[test_babel_4279_st1].[ABC.nfds] from test_babel_4279_s1.test_babel_4279_st1; +GO + +USE MASTER +GO + +CREATE VIEW test_babel_4279_v3 AS SELECT ["test_babel_4279_d.1"].[test_babel_4279_s1].[test_babel_4279_st1].[ABC.nfds] from ["test_babel_4279_d.1"].[test_babel_4279_s1].[test_babel_4279_st1]; +GO + +CREATE TABLE test_babel_4279_t2(您您对您对您对您对您对您对您对您对您对您您您 INT, 对您对您对您对您对您对您对您 INT); +GO + +CREATE VIEW test_babel_4279_v4 AS SELECT test_babel_4279_t2.[您您对您对您对您对您对您对您对您对您对您您您] from test_babel_4279_t2; +GO + +CREATE VIEW test_babel_4279_v5 AS SELECT ぁあ.[您您对您对您对您对您对您对您对您对您对您您您] from test_babel_4279_t2 AS ぁあ; +GO + +CREATE SCHEMA "tngdf'"; +GO + +CREATE TABLE "tngdf'".[sc,sdg"fdsngjds']("AB[C" INT); +GO + +CREATE VIEW test_babel_4279_v6 AS SELECT "tngdf'".[sc,sdg"fdsngjds']."AB[C" from "tngdf'".[sc,sdg"fdsngjds']; +GO + +CREATE TABLE test_babel_4279_t3(ABCD INT); +GO + +CREATE VIEW test_babel_4279_v7 AS SELECT test_babel_4279_t3.ABCD FROM test_babel_4279_t3; +GO + +CREATE TABLE test_babel_4279_t4([ぁあ'"] INT); +GO + +CREATE VIEW test_babel_4279_v8 AS SELECT test_babel_4279_t4.[ぁあ'"] FROM test_babel_4279_t4; +GO + +-- psql +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v1'; +GO +~~START~~ +text + SELECT "abc.nfds" AS "ABC.nfds" FROM master_dbo.test_babel_4279_t1; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v2'; +GO +~~START~~ +text + SELECT "abc.nfds" AS "ABC.nfds", "def.j" AS "DEf.j" FROM master_dbo.test_babel_4279_t1; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_sv1'; +GO +~~START~~ +text + SELECT "abc.nfds" AS "ABC.nfds" FROM test_babel_4279_s1.test_babel_4279_st1; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v3'; +GO +~~START~~ +text + SELECT "abc.nfds" AS "ABC.nfds" FROM test_babel_4279_s1.test_babel_4279_st1; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v4'; +GO +~~START~~ +text + SELECT "您您对您对您对您对您d60211ff7d947ff09db87babbf0cb9de" FROM master_dbo.test_babel_4279_t2; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v5'; +GO +~~START~~ +text + SELECT "您您对您对您对您对您d60211ff7d947ff09db87babbf0cb9de" FROM master_dbo.test_babel_4279_t2 "ぁあ"; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v6'; +GO +~~START~~ +text + SELECT "ab[c" AS "AB[C" FROM "master_tngdf'"."sc,sdg""fdsngjds'"; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v7'; +GO +~~START~~ +text + SELECT abcd AS "ABCD" FROM master_dbo.test_babel_4279_t3; +~~END~~ + + +SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_babel_4279_v8'; +GO +~~START~~ +text + SELECT "ぁあ'""" FROM master_dbo.test_babel_4279_t4; +~~END~~ + + +-- tsql +DROP VIEW test_babel_4279_v3; +GO + +USE ["test_babel_4279_d.1"]; +GO + +DROP VIEW test_babel_4279_sv1; +GO + +DROP TABLE test_babel_4279_s1.test_babel_4279_st1; +GO + +DROP SCHEMA test_babel_4279_s1; +GO + +USE MASTER; +GO + +DROP VIEW test_babel_4279_v4; +GO + +DROP VIEW test_babel_4279_v5; +GO + +DROP TABLE test_babel_4279_t2; +GO + +DROP VIEW test_babel_4279_v6; +GO + +DROP TABLE "tngdf'".[sc,sdg"fdsngjds']; +GO + +DROP SCHEMA "tngdf'"; +GO + +DROP VIEW test_babel_4279_v7; +GO + +DROP TABLE test_babel_4279_t3; +GO + +DROP VIEW test_babel_4279_v8; +GO + +DROP TABLE test_babel_4279_t4; +GO + +DROP DATABASE ["test_babel_4279_d.1"]; +GO + +DROP VIEW test_babel_4279_v1; +GO + +DROP VIEW test_babel_4279_v2; +GO + +DROP TABLE test_babel_4279_t1; +GO + +CREATE TABLE t2(c int) +GO + +CREATE TABLE t1(c int) +GO + +-- should not crash when column followed by '\n'|'\t' etc. +CREATE VIEW v +AS +SELECT t1.c +FROM dbo.t2 INNER JOIN t1 +ON t2.c = t1.c +GO + +DROP VIEW v +GO + +DROP TABLE t2 +GO + +DROP TABLE t1 +GO + +CREATE TABLE t3(RecordEntryId bigint NOT NULL) +GO + +CREATE FUNCTION tvf_t3(@UserId BIGINT) +RETURNS TABLE +AS +RETURN +( +select rp.RecordEntryId +from dbo.t3 rp +) +GO + +DROP FUNCTION tvf_t3 +GO + +DROP TABLE t3 +GO diff --git a/test/JDBC/expected/test_search_path.out b/test/JDBC/expected/test_search_path.out index 81497ecb16..28790694cf 100644 --- a/test/JDBC/expected/test_search_path.out +++ b/test/JDBC/expected/test_search_path.out @@ -1,26 +1,3 @@ -CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) -GO -INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') -GO -~~ROW COUNT: 1~~ - - --- test multi-db mode -SELECT set_config('role', 'jdbc_user', false); -GO -~~START~~ -text -jdbc_user -~~END~~ - -SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); -GO -~~START~~ -text -multi-db -~~END~~ - - -- check if correct schema is present in search path CREATE DATABASE ["BABEL_5111.db"] GO @@ -355,25 +332,3 @@ GO DROP DATABASE ["龙漫远; 龍漫遠.¢£€¥"] GO - -SELECT set_config('role', 'jdbc_user', false); -GO -~~START~~ -text -jdbc_user -~~END~~ - - --- Reset migration mode to default -DECLARE @mig_mode VARCHAR(10) -SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) -SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END -GO -~~START~~ -int -1 -~~END~~ - - -Drop Table IF EXISTS babelfish_migration_mode_table -GO diff --git a/test/JDBC/input/BABEL-4279.mix b/test/JDBC/input/BABEL-4279.mix index b9a483bb2c..f91add47a4 100644 --- a/test/JDBC/input/BABEL-4279.mix +++ b/test/JDBC/input/BABEL-4279.mix @@ -1,15 +1,4 @@ --- tsql -CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) -GO -INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') -GO - --- test multi-db mode -SELECT set_config('role', 'jdbc_user', false); -GO -SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); -GO - +-- single_db_mode_expected -- tsql CREATE TABLE test_babel_4279_t1([ABC.nfds] INT, [DEf.j] INT); GO @@ -332,15 +321,3 @@ GO DROP TABLE t3 GO - -SELECT set_config('role', 'jdbc_user', false); -GO - --- Reset migration mode to default -DECLARE @mig_mode VARCHAR(10) -SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) -SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END -GO - -Drop Table IF EXISTS babelfish_migration_mode_table -GO \ No newline at end of file diff --git a/test/JDBC/input/test_search_path.sql b/test/JDBC/input/test_search_path.sql index 98a3eaad8e..df9d19654b 100644 --- a/test/JDBC/input/test_search_path.sql +++ b/test/JDBC/input/test_search_path.sql @@ -1,14 +1,3 @@ -CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) -GO -INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') -GO - --- test multi-db mode -SELECT set_config('role', 'jdbc_user', false); -GO -SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); -GO - -- check if correct schema is present in search path CREATE DATABASE ["BABEL_5111.db"] GO @@ -266,16 +255,4 @@ DROP DATABASE ["BABEL_5111.db"] GO DROP DATABASE ["龙漫远; 龍漫遠.¢£€¥"] -GO - -SELECT set_config('role', 'jdbc_user', false); -GO - --- Reset migration mode to default -DECLARE @mig_mode VARCHAR(10) -SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) -SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END -GO - -Drop Table IF EXISTS babelfish_migration_mode_table GO \ No newline at end of file diff --git a/test/JDBC/jdbc_schedule b/test/JDBC/jdbc_schedule index 612d5b0c2e..5957da1d5e 100644 --- a/test/JDBC/jdbc_schedule +++ b/test/JDBC/jdbc_schedule @@ -12,14 +12,12 @@ all ignore#!#BABEL-1435 ignore#!#BABEL-1446 -ignore#!#BABEL-4279 ignore#!#TestSpatialPoint-vu-prepare ignore#!#TestSpatialPoint-vu-verify ignore#!#TestSpatialPoint-vu-cleanup ignore#!#babelfish_migration_mode-vu-prepare ignore#!#babelfish_migration_mode-vu-verify ignore#!#babelfish_migration_mode-vu-cleanup -ignore#!#test_search_path # BABEL-SP_FKEYS test is very slow and causing github action timeout. diff --git a/test/JDBC/singledb_jdbc_schedule b/test/JDBC/singledb_jdbc_schedule index 7f53782b0d..762530407d 100644 --- a/test/JDBC/singledb_jdbc_schedule +++ b/test/JDBC/singledb_jdbc_schedule @@ -8,5 +8,6 @@ ignore#!#test_db_collation-vu-cleanup ignore#!#BABEL-CROSS-DB ignore#!#BABEL-SYS-DATABASES ignore#!#Test-sp_reset_connection +ignore#!#test_search_path