修复发布订阅dump用例失败问题
This commit is contained in:
@ -1311,7 +1311,7 @@ static void AppendSubPartitionDetail(StringInfo buf, tableInfo tableinfo, Subpar
|
||||
"FROM pg_catalog.pg_partition p LEFT JOIN pg_catalog.pg_tablespace t "
|
||||
"ON p.reltablespace = t.oid "
|
||||
"WHERE p.parentid = %u AND p.parttype = '%c' AND p.partstrategy = '%c' "
|
||||
"ORDER BY p.boundaries[1]::%s ASC",
|
||||
"ORDER BY p.boundaries[1]::%s ASC NULLS LAST",
|
||||
subpartinfo->subparentid, PART_OBJ_TYPE_TABLE_SUB_PARTITION, subpartinfo->subparttype,
|
||||
get_typename(subpartinfo->subpartkeytype));
|
||||
|
||||
@ -1391,9 +1391,9 @@ static void AppendRangeIntervalPartitionInfo(StringInfo buf, Oid tableoid, table
|
||||
tableoid, PART_OBJ_TYPE_TABLE_PARTITION, PART_STRATEGY_RANGE);
|
||||
for (int i = 1; i <= partkeynum; i++) {
|
||||
if (i == partkeynum) {
|
||||
appendStringInfo(query, "p.boundaries[%d]::%s ASC", i, get_typename(iPartboundary[i - 1]));
|
||||
appendStringInfo(query, "p.boundaries[%d]::%s ASC NULLS LAST", i, get_typename(iPartboundary[i - 1]));
|
||||
} else {
|
||||
appendStringInfo(query, "p.boundaries[%d]::%s, ", i, get_typename(iPartboundary[i - 1]));
|
||||
appendStringInfo(query, "p.boundaries[%d]::%s NULLS LAST, ", i, get_typename(iPartboundary[i - 1]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1470,7 +1470,7 @@ static void AppendListPartitionInfo(StringInfo buf, Oid tableoid, tableInfo tabl
|
||||
"FROM pg_catalog.pg_partition p LEFT JOIN pg_catalog.pg_tablespace t "
|
||||
"ON p.reltablespace = t.oid "
|
||||
"WHERE p.parentid = %u AND p.parttype = '%c' "
|
||||
"AND p.partstrategy = '%c' ORDER BY p.boundaries[1]::%s ASC",
|
||||
"AND p.partstrategy = '%c' ORDER BY p.boundaries[1]::%s ASC NULLS LAST",
|
||||
tableoid, PART_OBJ_TYPE_TABLE_PARTITION, PART_STRATEGY_LIST, get_typename(*iPartboundary));
|
||||
} else {
|
||||
appendStringInfo(query,
|
||||
@ -1478,7 +1478,7 @@ static void AppendListPartitionInfo(StringInfo buf, Oid tableoid, tableInfo tabl
|
||||
"p.bound_def AS partbound, "
|
||||
"p.oid AS partoid, "
|
||||
"t.spcname AS reltblspc FROM ( "
|
||||
"SELECT oid, relname, reltablespace, pg_catalog.string_agg(bound,',' ORDER BY bound_id) AS bound_def FROM( "
|
||||
"SELECT oid, relname, reltablespace, pg_catalog.string_agg(bound,',' ORDER BY bound_id NULLS LAST) AS bound_def FROM( "
|
||||
"SELECT oid, relname, reltablespace, bound_id, '('||"
|
||||
"pg_catalog.array_to_string(pg_catalog.array_agg(key_value ORDER BY key_id), ',', 'NULL')||')' AS bound "
|
||||
"FROM ( SELECT oid, relname, reltablespace, bound_id, key_id, ");
|
||||
@ -1511,7 +1511,7 @@ static void AppendListPartitionInfo(StringInfo buf, Oid tableoid, tableInfo tabl
|
||||
"UNION ALL SELECT oid, relname, reltablespace, 'DEFAULT' AS bound_def FROM pg_catalog.pg_partition "
|
||||
"WHERE parentid = %u AND parttype = '%c' AND partstrategy = '%c' AND boundaries[1] IS NULL) p "
|
||||
"LEFT JOIN pg_catalog.pg_tablespace t ON p.reltablespace = t.oid "
|
||||
"ORDER BY p.bound_def ASC",
|
||||
"ORDER BY p.bound_def ASC NULLS LAST",
|
||||
tableoid, PART_OBJ_TYPE_TABLE_PARTITION, PART_STRATEGY_LIST,
|
||||
tableoid, PART_OBJ_TYPE_TABLE_PARTITION, PART_STRATEGY_LIST);
|
||||
}
|
||||
@ -1579,7 +1579,7 @@ static void AppendHashPartitionInfo(StringInfo buf, Oid tableoid, tableInfo tabl
|
||||
"WHERE p.parentid = %u AND p.parttype = '%c' "
|
||||
"AND p.partstrategy = '%c' ORDER BY ",
|
||||
tableoid, PART_OBJ_TYPE_TABLE_PARTITION, PART_STRATEGY_HASH);
|
||||
appendStringInfo(query, "p.boundaries[1]::%s ASC", get_typename(*iPartboundary));
|
||||
appendStringInfo(query, "p.boundaries[1]::%s ASC NULLS LAST", get_typename(*iPartboundary));
|
||||
|
||||
(void)SPI_execute(query->data, true, INT_MAX);
|
||||
int proc = SPI_processed;
|
||||
|
||||
@ -29,18 +29,26 @@ gsctl_wait_time=3600
|
||||
data_dir=$g_data_path
|
||||
|
||||
function exec_sql(){
|
||||
result=$(gsql -d $1 -p $2 -Atq -c "$3")
|
||||
execStr=$3
|
||||
if [[ $3 == "CREATE DATABASE"* ]] || [[ $3 == "DROP DATABASE"* ]]; then
|
||||
execStr="set dolphin.b_compatibility_mode = off;"$3
|
||||
fi
|
||||
result=$(gsql -d $1 -p $2 -Atq -c "$execStr")
|
||||
if [ "$result" != "" ]; then
|
||||
echo "$result"
|
||||
fi
|
||||
}
|
||||
|
||||
function exec_sql_with_user() {
|
||||
execStr=$3
|
||||
if [[ $3 == "CREATE DATABASE"* ]] || [[ $3 == "DROP DATABASE"* ]]; then
|
||||
execStr="set dolphin.b_compatibility_mode = off;"$3
|
||||
fi
|
||||
local sql_user=$username
|
||||
if [ -n "$test_username" ]; then
|
||||
sql_user=$test_username
|
||||
fi
|
||||
result=$(gsql -U $sql_user -W $passwd -d $1 -p $2 -Atq -c "$3")
|
||||
result=$(gsql -U $sql_user -W $passwd -d $1 -p $2 -Atq -c "$execStr")
|
||||
if [ "$result" != "" ]; then
|
||||
echo "$result"
|
||||
fi
|
||||
|
||||
@ -46,7 +46,7 @@ function test_1() {
|
||||
exec_dump_db $case_db $pub_node1_port "$dump_result_dir/dump_db_pub${pub_ddl}.pub" "all"
|
||||
sedcmd="sed -i -e s/gauss/${g_username}/g $dump_expected_dir/dump_db_pub${pub_ddl}.pub"
|
||||
$sedcmd
|
||||
diff $dump_result_dir/dump_db_pub${pub_ddl}.pub $dump_expected_dir/dump_db_pub${pub_ddl}.pub > ${dump_result_dir}/dump_pub${pub_ddl}_pub.diff
|
||||
diff -I "dolphin.sql_mode" $dump_result_dir/dump_db_pub${pub_ddl}.pub $dump_expected_dir/dump_db_pub${pub_ddl}.pub > ${dump_result_dir}/dump_pub${pub_ddl}_pub.diff
|
||||
if [ -s ${dump_result_dir}/dump_puball_pub.diff ]; then
|
||||
echo "$failed_keyword when dump publication"
|
||||
exit 1
|
||||
@ -57,7 +57,7 @@ function test_1() {
|
||||
exec_dump_db $case_db $sub_node1_port "$dump_result_dir/dump_db_pub${pub_ddl}.sub" "all"
|
||||
sedcmd="sed -i -e s/gauss/${g_username}/g $dump_expected_dir/dump_db_pub${pub_ddl}.sub"
|
||||
$sedcmd
|
||||
diff $dump_result_dir/dump_db_pub${pub_ddl}.sub $dump_expected_dir/dump_db_pub${pub_ddl}.sub > ${dump_result_dir}/dump_pub${pub_ddl}_sub.diff --ignore-matching-lines='password=encryptOpt'
|
||||
diff -I "dolphin.sql_mode" $dump_result_dir/dump_db_pub${pub_ddl}.sub $dump_expected_dir/dump_db_pub${pub_ddl}.sub > ${dump_result_dir}/dump_pub${pub_ddl}_sub.diff --ignore-matching-lines='password=encryptOpt'
|
||||
if [ -s ${dump_result_dir}/dump_pub${pub_ddl}_sub.diff ]; then
|
||||
echo "$failed_keyword when dump subscription"
|
||||
exit 1
|
||||
|
||||
@ -147,7 +147,7 @@ function test_1() {
|
||||
(ROW(2.0, 'b', 2), ARRAY[ROW(2, 'b', 2)::tst_comp_basic_t]),
|
||||
(ROW(3.0, 'c', 3), ARRAY[ROW(3, 'c', 3)::tst_comp_basic_t]),
|
||||
(ROW(4.0, 'd', 4), ARRAY[ROW(4, 'd', 3)::tst_comp_basic_t]),
|
||||
(ROW(5.0, 'e', NULL), ARRAY[NULL, ROW(5, NULL, 5)::tst_comp_basic_t]);
|
||||
(ROW(5.0, 'e', 5), ARRAY[NULL, ROW(5, NULL, 5)::tst_comp_basic_t]);
|
||||
|
||||
-- test_tbl_composite_with_enums
|
||||
INSERT INTO tst_comp_enum (a, b) VALUES
|
||||
@ -179,7 +179,7 @@ function test_1() {
|
||||
(ROW(2.0, '{b, c, a}', 2), ARRAY[ROW(2, '{b, c, a}', 1)::tst_comp_enum_array_t]),
|
||||
(ROW(3.0, '{c, a, b}', 1), ARRAY[ROW(3, '{c, a, b}', 1)::tst_comp_enum_array_t]),
|
||||
(ROW(4.0, '{c, b, d}', 4), ARRAY[ROW(4, '{c, b, d}', 4)::tst_comp_enum_array_t]),
|
||||
(ROW(5.0, '{c, NULL, b}', NULL), ARRAY[ROW(5, '{c, e, b}', 1)::tst_comp_enum_array_t]);
|
||||
(ROW(5.0, '{c, NULL, b}', 5), ARRAY[ROW(5, '{c, e, b}', 1)::tst_comp_enum_array_t]);
|
||||
|
||||
-- test_tbl_mixed_composites
|
||||
INSERT INTO tst_comp_mix_array (a, b) VALUES
|
||||
@ -260,7 +260,7 @@ e|{d,NULL}
|
||||
(2,b,2)|{\"(2,b,2)\"}
|
||||
(3,c,3)|{\"(3,c,3)\"}
|
||||
(4,d,4)|{\"(4,d,3)\"}
|
||||
(5,e,)|{NULL,\"(5,,5)\"}
|
||||
(5,e,5)|{NULL,\"(5,,5)\"}
|
||||
1|(1,a,1)
|
||||
2|(2,b,2)
|
||||
3|(3,c,3)
|
||||
@ -280,7 +280,7 @@ e|{d,NULL}
|
||||
(2,\"{b,c,a}\",2)|{\"(2,\\\""{b,c,a}\\\"",1)\"}
|
||||
(3,\"{c,a,b}\",1)|{\"(3,\\\""{c,a,b}\\\"",1)\"}
|
||||
(4,\"{c,b,d}\",4)|{\"(4,\\\""{c,b,d}\\\"",4)\"}
|
||||
(5,\"{c,NULL,b}\",)|{\"(5,\\\""{c,e,b}\\\"",1)\"}
|
||||
(5,\"{c,NULL,b}\",5)|{\"(5,\\\""{c,e,b}\\\"",1)\"}
|
||||
(\"(1,a,1)\",\"{\"\"(1,a,1)\"\",\"\"(2,b,2)\"\"}\",a,\"{a,b,NULL,c}\")|{\"(\\\"(1,a,1)\\\",\\\"{\\\"\\\"(1,a,1)\\\"\\\",\\\"\\\"(2,b,2)\\\"\\\",NULL}\\\",a,\\\"{a,b,c}\\\")\"}
|
||||
1|[1,11)
|
||||
2|[2,21)
|
||||
@ -379,7 +379,7 @@ e|{e,d}
|
||||
(2,b,2)|{\"(2,b,2)\"}
|
||||
(3,c,3)|{\"(3,c,3)\"}
|
||||
(4,d,4)|{NULL,\"(9,x,)\"}
|
||||
(5,e,)|{NULL,\"(9,x,)\"}
|
||||
(5,e,5)|{NULL,\"(9,x,)\"}
|
||||
1|(1,,)
|
||||
2|(2,b,2)
|
||||
3|(3,c,3)
|
||||
@ -399,7 +399,7 @@ e|{e,d}
|
||||
(2,\"{b,c,a}\",2)|{\"(2,\\\""{b,c,a}\\\"",1)\"}
|
||||
(3,\"{c,a,b}\",1)|{\"(3,\\\""{c,a,b}\\\"",1)\"}
|
||||
(4,\"{c,b,d}\",4)|{\"(5,\\\""{a,b,c}\\\"",5)\"}
|
||||
(5,\"{c,NULL,b}\",)|{\"(5,\\\""{a,b,c}\\\"",5)\"}
|
||||
(5,\"{c,NULL,b}\",5)|{\"(5,\\\""{a,b,c}\\\"",5)\"}
|
||||
(\"(1,a,1)\",\"{\"\"(1,a,1)\"\",\"\"(2,b,2)\"\"}\",a,\"{a,b,NULL,c}\")|{\"(\\\"(1,a,1)\\\",\\\"{\\\"\\\"(1,a,1)\\\"\\\",\\\"\\\"(2,b,2)\\\"\\\",NULL}\\\",a,\\\"{a,b,c}\\\")\",NULL}
|
||||
1|[100,1001)
|
||||
2|[2,21)
|
||||
@ -460,9 +460,9 @@ e|{e,d}
|
||||
DELETE FROM tst_comp_enum_what WHERE (b[1]).b = '{c, a, b}';
|
||||
DELETE FROM tst_comp_mix_array WHERE ((a).a).a = 1;
|
||||
DELETE FROM tst_range WHERE a = 1;
|
||||
DELETE FROM tst_range WHERE '[10,20]' && b;
|
||||
DELETE FROM tst_range WHERE range_overlaps('[10,20]', b);
|
||||
DELETE FROM tst_range_array WHERE a = 1;
|
||||
DELETE FROM tst_range_array WHERE tstzrange('Mon Aug 04 00:00:00 2014 CEST'::timestamptz, 'Mon Aug 05 00:00:00 2014 CEST'::timestamptz) && b;
|
||||
DELETE FROM tst_range_array WHERE range_overlaps(tstzrange('Mon Aug 04 00:00:00 2014 CEST'::timestamptz, 'Mon Aug 05 00:00:00 2014 CEST'::timestamptz), b);
|
||||
DELETE FROM tst_hstore WHERE a = 1;"
|
||||
|
||||
wait_for_catchup $case_db $pub_node1_port "tap_sub_slot"
|
||||
@ -485,7 +485,7 @@ e|{e,d}
|
||||
5|(,x,-1)
|
||||
(2,b,2)|{\"(2,b,2)\"}
|
||||
(4,d,4)|{NULL,\"(9,x,)\"}
|
||||
(5,e,)|{NULL,\"(9,x,)\"}
|
||||
(5,e,5)|{NULL,\"(9,x,)\"}
|
||||
3|(3,c,3)
|
||||
4|(4,d,44)
|
||||
5|(4,d,44)
|
||||
@ -496,7 +496,7 @@ e|{e,d}
|
||||
5|(4,\"{c,b,d}\",4)
|
||||
(2,\"{b,c,a}\",2)|{\"(2,\\\""{b,c,a}\\\"",1)\"}
|
||||
(4,\"{c,b,d}\",4)|{\"(5,\\\""{a,b,c}\\\"",5)\"}
|
||||
(5,\"{c,NULL,b}\",)|{\"(5,\\\""{a,b,c}\\\"",5)\"}
|
||||
(5,\"{c,NULL,b}\",5)|{\"(5,\\\""{a,b,c}\\\"",5)\"}
|
||||
2|[\"2014-08-02 00:00:00+02\",\"2014-08-04 00:00:00+02\")|{\"[2,4)\",\"[20,31)\"}
|
||||
3|[\"2014-08-01 00:00:00+02\",\"2014-08-04 00:00:00+02\")|{\"[3,5)\"}
|
||||
2|\"updated\"=>\"value\"
|
||||
|
||||
Reference in New Issue
Block a user