From ef9555365854579100bf35c4f2214fbbf269e435 Mon Sep 17 00:00:00 2001 From: Halil Ozan Akgul Date: Thu, 19 Aug 2021 18:12:00 +0300 Subject: [PATCH 1/7] Removes password outputs from alter_role_propagation tests --- .../expected/alter_role_propagation.out | 57 ++++++++++++++----- .../regress/sql/alter_role_propagation.sql | 12 ++-- 2 files changed, 50 insertions(+), 19 deletions(-) diff --git a/src/test/regress/expected/alter_role_propagation.out b/src/test/regress/expected/alter_role_propagation.out index 05072ddff..02b798e0b 100644 --- a/src/test/regress/expected/alter_role_propagation.out +++ b/src/test/regress/expected/alter_role_propagation.out @@ -2,11 +2,18 @@ CREATE SCHEMA alter_role; CREATE SCHEMA ",CitUs,.TeeN!?"; -- test if the passowrd of the extension owner can be upgraded ALTER ROLE CURRENT_USER PASSWORD 'password123' VALID UNTIL 'infinity'; -SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); - run_command_on_workers +SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); + run_command_on_workers --------------------------------------------------------------------- - (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,-1,md5891d7d5079424b1cb973187d354d78de,Infinity)") - (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,-1,md5891d7d5079424b1cb973187d354d78de,Infinity)") + (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,-1,Infinity)") + (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,-1,Infinity)") +(2 rows) + +SELECT workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = current_user$$) workers, pg_authid WHERE pg_authid.rolname = current_user; + password_is_same +--------------------------------------------------------------------- + t + t (2 rows) -- test if the password and some connection settings are propagated when a node gets added @@ -16,11 +23,18 @@ SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlog --------------------------------------------------------------------- (0 rows) -SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); - run_command_on_workers +SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); + run_command_on_workers --------------------------------------------------------------------- - (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,66,md568701dc40be546e0357027fb0109338c,2032)") - (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,66,md568701dc40be546e0357027fb0109338c,2032)") + (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,66,2032)") + (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,66,2032)") +(2 rows) + +SELECT workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = current_user$$) workers, pg_authid WHERE pg_authid.rolname = current_user; + password_is_same +--------------------------------------------------------------------- + t + t (2 rows) SELECT master_remove_node('localhost', :worker_1_port); @@ -35,10 +49,16 @@ SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlog --------------------------------------------------------------------- (0 rows) -SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); - run_command_on_workers +SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); + run_command_on_workers --------------------------------------------------------------------- - (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,0,md53e559cc1fcf0c70f1f8e05c9a79c3133,2052)") + (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,0,2052)") +(1 row) + +SELECT workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = current_user$$) workers, pg_authid WHERE pg_authid.rolname = current_user; + password_is_same +--------------------------------------------------------------------- + t (1 row) SELECT 1 FROM master_add_node('localhost', :worker_1_port); @@ -52,11 +72,18 @@ SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlog --------------------------------------------------------------------- (0 rows) -SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); - run_command_on_workers +SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); + run_command_on_workers --------------------------------------------------------------------- - (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,0,md53e559cc1fcf0c70f1f8e05c9a79c3133,2052)") - (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,0,md53e559cc1fcf0c70f1f8e05c9a79c3133,2052)") + (localhost,57637,t,"(postgres,t,t,t,t,t,t,t,0,2052)") + (localhost,57638,t,"(postgres,t,t,t,t,t,t,t,0,2052)") +(2 rows) + +SELECT workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = current_user$$) workers, pg_authid WHERE pg_authid.rolname = current_user; + password_is_same +--------------------------------------------------------------------- + t + t (2 rows) -- check user, database and postgres wide SET settings. diff --git a/src/test/regress/sql/alter_role_propagation.sql b/src/test/regress/sql/alter_role_propagation.sql index e42cde447..627b0a1f2 100644 --- a/src/test/regress/sql/alter_role_propagation.sql +++ b/src/test/regress/sql/alter_role_propagation.sql @@ -3,19 +3,23 @@ CREATE SCHEMA ",CitUs,.TeeN!?"; -- test if the passowrd of the extension owner can be upgraded ALTER ROLE CURRENT_USER PASSWORD 'password123' VALID UNTIL 'infinity'; -SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); +SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); +SELECT workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = current_user$$) workers, pg_authid WHERE pg_authid.rolname = current_user; -- test if the password and some connection settings are propagated when a node gets added ALTER ROLE CURRENT_USER WITH CONNECTION LIMIT 66 VALID UNTIL '2032-05-05' PASSWORD 'password456'; SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = 'alter_role_1'; -SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); +SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); +SELECT workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = current_user$$) workers, pg_authid WHERE pg_authid.rolname = current_user; SELECT master_remove_node('localhost', :worker_1_port); ALTER ROLE CURRENT_USER WITH CONNECTION LIMIT 0 VALID UNTIL '2052-05-05' PASSWORD 'password789'; SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = 'alter_role_1'; -SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); +SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); +SELECT workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = current_user$$) workers, pg_authid WHERE pg_authid.rolname = current_user; SELECT 1 FROM master_add_node('localhost', :worker_1_port); SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = 'alter_role_1'; -SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); +SELECT run_command_on_workers($$SELECT row(rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, EXTRACT (year FROM rolvaliduntil)) FROM pg_authid WHERE rolname = current_user$$); +SELECT workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = current_user$$) workers, pg_authid WHERE pg_authid.rolname = current_user; -- check user, database and postgres wide SET settings. -- pre check From 6494c7afe78a666075e86eb583b3cb605ae1ca76 Mon Sep 17 00:00:00 2001 From: Nils Dijk Date: Thu, 19 Aug 2021 17:25:07 +0200 Subject: [PATCH 2/7] add 14beta3 to CI --- .circleci/config.yml | 139 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 112 insertions(+), 27 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a3605457f..126ebe384 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -439,11 +439,15 @@ workflows: - build: name: build-12 pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' - build: name: build-13 pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' + - build: + name: build-14 + pg_major: 14 + image_tag: '14beta3-dev202108191715' - check-style - check-sql-snapshots @@ -451,151 +455,225 @@ workflows: - test-citus: name: 'test-12_check-multi' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-multi requires: [build-12] - test-citus: name: 'test-12_check-multi-1' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-multi-1 requires: [build-12] - test-citus: name: 'test-12_check-mx' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-multi-mx requires: [build-12] - test-citus: name: 'test-12_check-vanilla' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-vanilla requires: [build-12] - test-citus: name: 'test-12_check-isolation' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-isolation requires: [build-12] - test-citus: name: 'test-12_check-worker' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-worker requires: [build-12] - test-citus: name: 'test-12_check-operations' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-operations requires: [build-12] - test-citus: name: 'test-12_check-follower-cluster' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-follower-cluster requires: [build-12] - test-citus: name: 'test-12_check-columnar' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-columnar requires: [build-12] - test-citus: name: 'test-12_check-columnar-isolation' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-columnar-isolation requires: [build-12] - tap-test-citus: name: 'test_12_tap-recovery' pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' suite: recovery requires: [build-12] - test-citus: name: 'test-12_check-failure' pg_major: 12 image: citus/failtester - image_tag: '12.6' + image_tag: '12.6-dev202108191715' make: check-failure requires: [build-12] - test-citus: name: 'test-13_check-multi' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-multi requires: [build-13] - test-citus: name: 'test-13_check-multi-1' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-multi-1 requires: [build-13] - test-citus: name: 'test-13_check-mx' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-multi-mx requires: [build-13] - test-citus: name: 'test-13_check-vanilla' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-vanilla requires: [build-13] - test-citus: name: 'test-13_check-isolation' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-isolation requires: [build-13] - test-citus: name: 'test-13_check-worker' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-worker requires: [build-13] - test-citus: name: 'test-13_check-operations' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-operations requires: [build-13] - test-citus: name: 'test-13_check-follower-cluster' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-follower-cluster requires: [build-13] - test-citus: name: 'test-13_check-columnar' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-columnar requires: [build-13] - test-citus: name: 'test-13_check-columnar-isolation' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-columnar-isolation requires: [build-13] - tap-test-citus: name: 'test_13_tap-recovery' pg_major: 13 - image_tag: '13.2' + image_tag: '13.2-dev202108191715' suite: recovery requires: [build-13] - test-citus: name: 'test-13_check-failure' pg_major: 13 image: citus/failtester - image_tag: '13.2' + image_tag: '13.2-dev202108191715' make: check-failure requires: [build-13] + - test-citus: + name: 'test-14_check-multi' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-multi + requires: [build-14] + - test-citus: + name: 'test-14_check-multi-1' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-multi-1 + requires: [build-14] + - test-citus: + name: 'test-14_check-mx' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-multi-mx + requires: [build-14] + - test-citus: + name: 'test-14_check-vanilla' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-vanilla + requires: [build-14] + - test-citus: + name: 'test-14_check-isolation' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-isolation + requires: [build-14] + - test-citus: + name: 'test-14_check-worker' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-worker + requires: [build-14] + - test-citus: + name: 'test-14_check-operations' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-operations + requires: [build-14] + - test-citus: + name: 'test-14_check-follower-cluster' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-follower-cluster + requires: [build-14] + - test-citus: + name: 'test-14_check-columnar' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-columnar + requires: [build-14] + - test-citus: + name: 'test-14_check-columnar-isolation' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + make: check-columnar-isolation + requires: [build-14] + - tap-test-citus: + name: 'test_14_tap-recovery' + pg_major: 14 + image_tag: '14beta3-dev202108191715' + suite: recovery + requires: [build-14] + - test-citus: + name: 'test-14_check-failure' + pg_major: 14 + image: citus/failtester + image_tag: '14beta3-dev202108191715' + make: check-failure + requires: [build-14] + - test-pg-upgrade: name: 'test-12-13_check-pg-upgrade' old_pg_major: 12 @@ -603,10 +681,17 @@ workflows: image_tag: 12-13 requires: [build-12,build-13] + - test-pg-upgrade: + name: 'test-13-14_check-pg-upgrade' + old_pg_major: 13 + new_pg_major: 14 + image_tag: 12-13-14 + requires: [build-13,build-14] + - test-citus-upgrade: name: test-12_check-citus-upgrade pg_major: 12 - image_tag: '12.6' + image_tag: '12.6-dev202108191715' requires: [build-12] - ch_benchmark: From f4290d8004fa7bf4401c3018b4cb665b557fa41b Mon Sep 17 00:00:00 2001 From: Nils Dijk Date: Thu, 19 Aug 2021 17:44:55 +0200 Subject: [PATCH 3/7] add missing define with old value --- src/include/distributed/version_compat.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/include/distributed/version_compat.h b/src/include/distributed/version_compat.h index 960ef8eef..fba6cfe99 100644 --- a/src/include/distributed/version_compat.h +++ b/src/include/distributed/version_compat.h @@ -93,6 +93,7 @@ ((&ProcGlobal->allPgXact[(pgproc)->pgprocno])->vacuumFlags) #define get_partition_parent_compat(a, b) get_partition_parent(a) #define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a) +#define PQ_LARGE_MESSAGE_LIMIT 0 #endif #if PG_VERSION_NUM >= PG_VERSION_13 From 533b031a31a4ba98238ff504b9868e62fd4c783e Mon Sep 17 00:00:00 2001 From: Halil Ozan Akgul Date: Thu, 19 Aug 2021 19:01:26 +0300 Subject: [PATCH 4/7] Introduces make_simple_restrictinfo_compat and pull_varnos_compat macros make_simple_restrictinfo and pull_varnos functions now have a new parameter These new macros give us the ability to use this new parameter for PG14 and they don't give the parameter for previous versions Relevant PG commit: 55dc86eca70b1dc18a79c141b3567efed910329d --- src/backend/distributed/operations/delete_protocol.c | 7 ++++--- src/backend/distributed/planner/insert_select_planner.c | 3 ++- .../distributed/planner/relation_restriction_equivalence.c | 2 +- src/include/distributed/version_compat.h | 4 ++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/backend/distributed/operations/delete_protocol.c b/src/backend/distributed/operations/delete_protocol.c index 38f35d76c..9fa7015ef 100644 --- a/src/backend/distributed/operations/delete_protocol.c +++ b/src/backend/distributed/operations/delete_protocol.c @@ -672,9 +672,10 @@ ShardsMatchingDeleteCriteria(Oid relationId, List *shardIntervalList, Expr *lessThanExpr = (Expr *) linitial(andExpr->args); Expr *greaterThanExpr = (Expr *) lsecond(andExpr->args); - RestrictInfo *lessThanRestrictInfo = make_simple_restrictinfo(NULL, lessThanExpr); - RestrictInfo *greaterThanRestrictInfo = make_simple_restrictinfo(NULL, - greaterThanExpr); + RestrictInfo *lessThanRestrictInfo = make_simple_restrictinfo_compat(NULL, + lessThanExpr); + RestrictInfo *greaterThanRestrictInfo = make_simple_restrictinfo_compat(NULL, + greaterThanExpr); restrictInfoList = lappend(restrictInfoList, lessThanRestrictInfo); restrictInfoList = lappend(restrictInfoList, greaterThanRestrictInfo); diff --git a/src/backend/distributed/planner/insert_select_planner.c b/src/backend/distributed/planner/insert_select_planner.c index 5384bf628..7975b6ec3 100644 --- a/src/backend/distributed/planner/insert_select_planner.c +++ b/src/backend/distributed/planner/insert_select_planner.c @@ -747,7 +747,8 @@ RouterModifyTaskForShardInterval(Query *originalQuery, continue; } - shardRestrictionList = make_simple_restrictinfo(NULL, (Expr *) shardOpExpressions); + shardRestrictionList = make_simple_restrictinfo_compat(NULL, + (Expr *) shardOpExpressions); extendedBaseRestrictInfo = lappend(extendedBaseRestrictInfo, shardRestrictionList); diff --git a/src/backend/distributed/planner/relation_restriction_equivalence.c b/src/backend/distributed/planner/relation_restriction_equivalence.c index 428309230..1c60d6ff7 100644 --- a/src/backend/distributed/planner/relation_restriction_equivalence.c +++ b/src/backend/distributed/planner/relation_restriction_equivalence.c @@ -2054,7 +2054,7 @@ GetRestrictInfoListForRelation(RangeTblEntry *rangeTblEntry, * If the restriction involves multiple tables, we cannot add it to * input relation's expression list. */ - Relids varnos = pull_varnos(NULL, (Node *) restrictionClause); + Relids varnos = pull_varnos_compat(NULL, (Node *) restrictionClause); if (bms_num_members(varnos) != 1) { continue; diff --git a/src/include/distributed/version_compat.h b/src/include/distributed/version_compat.h index fba6cfe99..8d5e8d663 100644 --- a/src/include/distributed/version_compat.h +++ b/src/include/distributed/version_compat.h @@ -60,6 +60,8 @@ #define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags) #define get_partition_parent_compat(a, b) get_partition_parent(a, b) #define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a, b) +#define make_simple_restrictinfo_compat(a, b) make_simple_restrictinfo(a, b) +#define pull_varnos_compat(a, b) pull_varnos(a, b) #else #define AlterTableStmtObjType(a) ((a)->relkind) #define F_NEXTVAL_COMPAT F_NEXTVAL_OID @@ -94,6 +96,8 @@ #define get_partition_parent_compat(a, b) get_partition_parent(a) #define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a) #define PQ_LARGE_MESSAGE_LIMIT 0 +#define make_simple_restrictinfo_compat(a, b) make_simple_restrictinfo(b) +#define pull_varnos_compat(a, b) pull_varnos(b) #endif #if PG_VERSION_NUM >= PG_VERSION_13 From 47054c8aedb730050572ed429914383430dcfdc7 Mon Sep 17 00:00:00 2001 From: Halil Ozan Akgul Date: Thu, 19 Aug 2021 19:33:10 +0300 Subject: [PATCH 5/7] Introduces pg_get_statisticsobj_worker_compat macro Relevant PG commit: a4d75c86bf15220df22de0a92c819ecef9db3849 --- src/backend/distributed/commands/statistics.c | 4 ++-- src/include/distributed/citus_ruleutils.h | 4 ++++ src/include/distributed/version_compat.h | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/commands/statistics.c b/src/backend/distributed/commands/statistics.c index 371b6c098..ababdd1a8 100644 --- a/src/backend/distributed/commands/statistics.c +++ b/src/backend/distributed/commands/statistics.c @@ -442,8 +442,8 @@ GetExplicitStatisticsCommandList(Oid relationId) foreach_oid(statisticsId, statisticsIdList) { /* we need create commands for already created stats before distribution */ - char *createStatisticsCommand = pg_get_statisticsobj_worker(statisticsId, - false, false); + char *createStatisticsCommand = pg_get_statisticsobj_worker_compat(statisticsId, + false, false); explicitStatisticsCommandList = lappend(explicitStatisticsCommandList, diff --git a/src/include/distributed/citus_ruleutils.h b/src/include/distributed/citus_ruleutils.h index 2bb008c5e..fac19352d 100644 --- a/src/include/distributed/citus_ruleutils.h +++ b/src/include/distributed/citus_ruleutils.h @@ -50,8 +50,12 @@ char * pg_get_rule_expr(Node *expression); extern void deparse_shard_query(Query *query, Oid distrelid, int64 shardid, StringInfo buffer); extern char * pg_get_triggerdef_command(Oid triggerId); +#if PG_VERSION_NUM >= PG_VERSION_14 extern char * pg_get_statisticsobj_worker(Oid statextid, bool columns_only, bool missing_ok); +#else +extern char * pg_get_statisticsobj_worker(Oid statextid, bool missing_ok); +#endif extern char * generate_relation_name(Oid relid, List *namespaces); extern char * generate_qualified_relation_name(Oid relid); extern char * generate_operator_name(Oid operid, Oid arg1, Oid arg2); diff --git a/src/include/distributed/version_compat.h b/src/include/distributed/version_compat.h index 8d5e8d663..1bbdd4334 100644 --- a/src/include/distributed/version_compat.h +++ b/src/include/distributed/version_compat.h @@ -62,6 +62,7 @@ #define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a, b) #define make_simple_restrictinfo_compat(a, b) make_simple_restrictinfo(a, b) #define pull_varnos_compat(a, b) pull_varnos(a, b) +#define pg_get_statisticsobj_worker_compat(a, b, c) pg_get_statisticsobj_worker(a, b, c) #else #define AlterTableStmtObjType(a) ((a)->relkind) #define F_NEXTVAL_COMPAT F_NEXTVAL_OID @@ -98,6 +99,7 @@ #define PQ_LARGE_MESSAGE_LIMIT 0 #define make_simple_restrictinfo_compat(a, b) make_simple_restrictinfo(b) #define pull_varnos_compat(a, b) pull_varnos(b) +#define pg_get_statisticsobj_worker_compat(a, b, c) pg_get_statisticsobj_worker(a, c) #endif #if PG_VERSION_NUM >= PG_VERSION_13 From 293818b93f03c47354fce9f2523ee1fa684f5b62 Mon Sep 17 00:00:00 2001 From: Halil Ozan Akgul Date: Thu, 19 Aug 2021 21:34:43 +0300 Subject: [PATCH 6/7] Puts usage of HASH_STRINGS in PG14 version check --- src/backend/distributed/utils/listutils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/utils/listutils.c b/src/backend/distributed/utils/listutils.c index 6267663f2..53bfcdd2b 100644 --- a/src/backend/distributed/utils/listutils.c +++ b/src/backend/distributed/utils/listutils.c @@ -138,9 +138,12 @@ ListToHashSet(List *itemList, Size keySize, bool isStringList) if (!isStringList) { flags |= HASH_BLOBS; - }else { + } +#if PG_VERSION_NUM >= PG_VERSION_14 + else { flags |= HASH_STRINGS; } +#endif HTAB *itemSet = hash_create("ListToHashSet", capacity, &info, flags); From 8cf5ec79427e736402f04d96757e9f2c33e64e7b Mon Sep 17 00:00:00 2001 From: Halil Ozan Akgul Date: Thu, 19 Aug 2021 21:42:32 +0300 Subject: [PATCH 7/7] Includes pg_version_constants.h in columnar_version_compat.h --- src/include/columnar/columnar_version_compat.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/include/columnar/columnar_version_compat.h b/src/include/columnar/columnar_version_compat.h index 0a51d4611..f42abc724 100644 --- a/src/include/columnar/columnar_version_compat.h +++ b/src/include/columnar/columnar_version_compat.h @@ -12,6 +12,8 @@ #ifndef COLUMNAR_COMPAT_H #define COLUMNAR_COMPAT_H +#include "distributed/pg_version_constants.h" + #if PG_VERSION_NUM >= PG_VERSION_14 #define ColumnarProcessUtility_compat(a, b, c, d, e, f, g, h) \ ColumnarProcessUtility(a, b, c, d, e, f, g, h)