Fix failing RE-SQL test cases for foreign tables on EPAS servers.

This commit is contained in:
Aditya Toshniwal 2023-09-29 13:38:22 +05:30
parent 68b7ddb592
commit b9d3006915
36 changed files with 472 additions and 0 deletions

View File

@ -0,0 +1,8 @@
ALTER FOREIGN TABLE public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_3_$%{}[]()&*^!@""'`\/#" TYPE time(10) with time zone ;
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_3_$%{}[]()&*^!@""'`\/#" DROP NOT NULL;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
IS 'test comment modification';

View File

@ -0,0 +1,9 @@
-- Column: public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "col_3_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" time(6) with time zone DEFAULT now();
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
IS 'test comment modification';

View File

@ -0,0 +1,5 @@
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_4_$%{}[]()&*^!@""'`\/#" OPTIONS (SET column_name 'test_options_update');
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_4_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=111);

View File

@ -0,0 +1,13 @@
-- Column: public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
-- ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "col_4_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" bigint OPTIONS (column_name 'test_options_update') NOT NULL GENERATED ALWAYS AS ((1000 + 1)) STORED;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
IS 'test comment';
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_4_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=111);

View File

@ -0,0 +1,5 @@
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" time with time zone NOT NULL DEFAULT now();
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
IS 'test comment';

View File

@ -0,0 +1,9 @@
-- Column: public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "col_3_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" time with time zone NOT NULL DEFAULT now();
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
IS 'test comment';

View File

@ -0,0 +1,9 @@
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" bigint OPTIONS (column_name 'test_options') NOT NULL GENERATED ALWAYS AS (1000+1) STORED;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
IS 'test comment';
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_4_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=1);

View File

@ -0,0 +1,13 @@
-- Column: public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
-- ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "col_4_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" bigint OPTIONS (column_name 'test_options') NOT NULL GENERATED ALWAYS AS ((1000 + 1)) STORED;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
IS 'test comment';
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_4_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=1);

View File

@ -0,0 +1,213 @@
{
"scenarios": [
{
"type": "create",
"name": "Create FDW for foreign table",
"endpoint": "NODE-foreign_data_wrapper.obj",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "test_fdw_for_foreign_table_columns",
"fdwacl": [],
"fdwoptions": []
},
"store_object_id": "True"
},
{
"type": "create",
"name": "Create foreign server for foreign table",
"endpoint": "NODE-foreign_server.obj",
"sql_endpoint": "NODE-foreign_server.sql_id",
"data": {
"name":"test_fs_for_foreign_table_column"
},
"store_object_id": "True"
},
{
"type": "create",
"name": "Create Foreign Table for testing column node.",
"endpoint": "NODE-foreign_table.obj",
"sql_endpoint": "NODE-foreign_table.sql_id",
"data": {
"name": "foreign_table_2_$%{}[]()&*^!@\"'`\\/#",
"columns": [],
"schema": "public",
"basensp": "public",
"ftsrvname": "test_fs_for_foreign_table_column",
"owner": "enterprisedb",
"ftoptions": [],
"inherits": [],
"relacl": [],
"seclabels": []
},
"store_object_id": "True"
},
{
"type": "create",
"name": "Create FT Column (Integer/Numeric type)",
"endpoint": "NODE-foreign_table_column.obj",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql",
"data": {
"name": "col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype": "numeric",
"attlen":"10",
"attprecision":"5",
"colconstype":"n",
"attnotnull": true,
"attoptions": [],
"seclabels": [],
"defval": "1"
},
"expected_sql_file": "create_column_numeric.sql",
"expected_msql_file": "create_column_numeric.msql"
},
{
"type": "alter",
"name": "Alter FT Column (Integer/Numeric type)",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql_id",
"data": {
"attnum": 1,
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for alter",
"cltype": "real",
"coloptions":{"added":[{"option":"column_name","value":"test"}]}
},
"expected_sql_file": "alter_column_numeric.sql",
"expected_msql_file": "alter_column_numeric.msql"
},
{
"type": "delete",
"name": "Drop FT Column (Integer/Numeric type)",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"data": {
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create FT Column with text & default value",
"endpoint": "NODE-foreign_table_column.obj",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql",
"data": {
"name": "col_2_$%{}[]()&*^!@\"'`\\/#",
"cltype": "text",
"description": "test comment",
"attnotnull": true,
"colconstype": "n",
"defval": "'xyz'"
},
"expected_sql_file": "create_column_text_with_default_value.sql",
"expected_msql_file": "create_column_text_with_default_value.msql"
},
{
"type": "alter",
"name": "Alter FT Column with text & update default value",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql_id",
"data": {
"attnum": 2,
"defval": "'changed default value'"
},
"expected_sql_file": "alter_column_text_with_default_value.sql",
"expected_msql_file": "alter_column_text_with_default_value.msql"
},
{
"type": "delete",
"name": "Drop FT column with text & update default value",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"data": {
"name": "col_2_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create FT Column with time with time zone & default value using function",
"endpoint": "NODE-foreign_table_column.obj",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql",
"data": {
"name": "col_3_$%{}[]()&*^!@\"'`\\/#",
"cltype": "time with time zone",
"attacl": [],
"description": "test comment",
"attnotnull": true,
"colconstype": "n",
"defval": "now()"
},
"expected_sql_file": "create_column_timestamp_with_default_value_using_function.sql",
"expected_msql_file": "create_column_timestamp_with_default_value_using_function.msql"
},
{
"type": "alter",
"name": "Alter FT Column with time with time zone & update length",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql_id",
"data": {
"attlen": "10",
"attnotnull": false,
"attnum":3,
"description": "test comment modification"
},
"expected_sql_file": "alter_column_timestamp_with_default_value_using_function.sql",
"expected_msql_file": "alter_column_timestamp_with_default_value_using_function.msql"
},
{
"type": "delete",
"name": "Drop FT Column with time with time zone",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"data": {
"name": "col_3_$%{}[]()&*^!@\"'`\\/"
}
},
{
"type": "create",
"name": "Create FT Column with integer & generated always with expression, column option, variables",
"endpoint": "NODE-foreign_table_column.obj",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql",
"data": {"name":"col_4_$%{}[]()&*^!@\"'`\\/#",
"description":"test comment",
"cltype":"bigint",
"attnotnull":true,
"coloptions":[{"option":"column_name","value":"test_options"}],
"colconstype":"g",
"is_tlength":false,
"is_precision":false,
"genexpr":"1000+1",
"attoptions":[{"name":"n_distinct","value":"1"}]},
"expected_sql_file": "create_column_with_integer_generated_always_column_option_variables.sql",
"expected_msql_file": "create_column_with_integer_generated_always_column_option_variables.msql"
},
{
"type": "alter",
"name": "Alter FT Column with integer & generated always with expression, column option, variables",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql_id",
"data":{
"attoptions":{
"changed":[{"name":"n_distinct","value":"111"}]},
"coloptions":{"changed":[{"option":"column_name","value":"test_options_update"}]},
"attnum":4},
"expected_sql_file": "alter_column_with_integer_generated_always_column_option_variables.sql",
"expected_msql_file": "alter_column_with_integer_generated_always_column_option_variables.msql"
},
{
"type": "delete",
"name": "Drop FT Column with time with time zone",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_columnn.sql_id",
"data": {
"name":"col_4_$%{}[]()&*^!@\"'`\\/#"
}
}
]}

View File

@ -0,0 +1,10 @@
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
RENAME "col_1_$%{}[]()&*^!@""'`\/#" TO "new_col_1_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#" OPTIONS (ADD column_name 'test');
ALTER FOREIGN TABLE public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#" TYPE real;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';

View File

@ -0,0 +1,9 @@
-- Column: public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
-- ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "new_col_1_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#" real OPTIONS (column_name 'test') NOT NULL DEFAULT 1;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';

View File

@ -0,0 +1,2 @@
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_2_$%{}[]()&*^!@""'`\/#" SET DEFAULT 'changed default value';

View File

@ -0,0 +1,9 @@
-- Column: public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
-- ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "col_2_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" text COLLATE pg_catalog."default" NOT NULL DEFAULT 'changed default value'::text;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
IS 'test comment';

View File

@ -0,0 +1,5 @@
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" numeric(10, 5) NOT NULL DEFAULT 1;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
-- ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "col_1_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" numeric(10,5) NOT NULL DEFAULT 1;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,5 @@
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" text NOT NULL DEFAULT 'xyz';
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
IS 'test comment';

View File

@ -0,0 +1,9 @@
-- Column: public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
-- ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "col_2_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN TABLE IF EXISTS public."foreign_table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" text COLLATE pg_catalog."default" NOT NULL DEFAULT 'xyz'::text;
COMMENT ON COLUMN public."foreign_table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
IS 'test comment';

View File

@ -0,0 +1,130 @@
{
"scenarios": [
{
"type": "create",
"name": "Create FDW for foreign table",
"endpoint": "NODE-foreign_data_wrapper.obj",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "test_fdw_for_foreign_table_columns",
"fdwacl": [],
"fdwoptions": []
},
"store_object_id": "True"
},
{
"type": "create",
"name": "Create foreign server for foreign table",
"endpoint": "NODE-foreign_server.obj",
"sql_endpoint": "NODE-foreign_server.sql_id",
"data": {
"name":"test_fs_for_foreign_table_column"
},
"store_object_id": "True"
},
{
"type": "create",
"name": "Create Foreign Table for testing column node.",
"endpoint": "NODE-foreign_table.obj",
"sql_endpoint": "NODE-foreign_table.sql_id",
"data": {
"name": "foreign_table_2_$%{}[]()&*^!@\"'`\\/#",
"columns": [],
"schema": "public",
"basensp": "public",
"ftsrvname": "test_fs_for_foreign_table_column",
"owner": "enterprisedb",
"ftoptions": [],
"inherits": [],
"relacl": [],
"seclabels": []
},
"store_object_id": "True"
},
{
"type": "create",
"name": "Create FT Column (Integer/Numeric type)",
"endpoint": "NODE-foreign_table_column.obj",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql",
"data": {
"name": "col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype": "numeric",
"attlen":"10",
"attprecision":"5",
"coloptions":[],
"colconstype":"n",
"attnotnull": true,
"attoptions": [],
"seclabels": [],
"defval": "1"
},
"expected_sql_file": "create_column_numeric.sql",
"expected_msql_file": "create_column_numeric.msql"
},
{
"type": "alter",
"name": "Alter FT Column (Integer/Numeric type)",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql_id",
"data": {
"attnum": 1,
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for alter",
"cltype": "real",
"coloptions":{"added":[{"option":"column_name","value":"test"}]}
},
"expected_sql_file": "alter_column_numeric.sql",
"expected_msql_file": "alter_column_numeric.msql"
},
{
"type": "delete",
"name": "Drop FT Column (Integer/Numeric type)",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"data": {
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create FT Column with text & default value",
"endpoint": "NODE-foreign_table_column.obj",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql",
"data": {
"name": "col_2_$%{}[]()&*^!@\"'`\\/#",
"cltype": "text",
"description": "test comment",
"attnotnull": true,
"colconstype": "n",
"defval": "'xyz'"
},
"expected_sql_file": "create_column_text_with_default_value.sql",
"expected_msql_file": "create_column_text_with_default_value.msql"
},
{
"type": "alter",
"name": "Alter FT Column with text & update default value",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"msql_endpoint": "NODE-foreign_table_column.msql_id",
"data": {
"attnum": 2,
"defval": "'changed default value'"
},
"expected_sql_file": "alter_column_text_with_default_value.sql",
"expected_msql_file": "alter_column_text_with_default_value.msql"
},
{
"type": "delete",
"name": "Drop FT column with text & update default value",
"endpoint": "NODE-foreign_table_column.obj_id",
"sql_endpoint": "NODE-foreign_table_column.sql_id",
"data": {
"name": "col_2_$%{}[]()&*^!@\"'`\\/#"
}
}
]}