diff --git a/src/backend/distributed/commands/function.c b/src/backend/distributed/commands/function.c index 7621838a1..7a2ba4997 100644 --- a/src/backend/distributed/commands/function.c +++ b/src/backend/distributed/commands/function.c @@ -19,6 +19,9 @@ #include "miscadmin.h" #include "funcapi.h" +#if PG_VERSION_NUM >= 120000 +#include "access/genam.h" +#endif #include "access/htup_details.h" #include "access/xact.h" #include "catalog/namespace.h" diff --git a/src/backend/distributed/planner/distributed_planner.c b/src/backend/distributed/planner/distributed_planner.c index c2956e1e0..c5a8af5f0 100644 --- a/src/backend/distributed/planner/distributed_planner.c +++ b/src/backend/distributed/planner/distributed_planner.c @@ -1176,7 +1176,11 @@ BlessRecordExpression(Expr *expr) ListCell *argCell = NULL; int currentResno = 1; +#if PG_VERSION_NUM >= 120000 + rowTupleDesc = CreateTemplateTupleDesc(list_length(rowExpr->args)); +#else rowTupleDesc = CreateTemplateTupleDesc(list_length(rowExpr->args), false); +#endif foreach(argCell, rowExpr->args) { diff --git a/src/test/regress/expected/local_shard_execution.out b/src/test/regress/expected/local_shard_execution.out index 290dc8730..00ed9a8a5 100644 --- a/src/test/regress/expected/local_shard_execution.out +++ b/src/test/regress/expected/local_shard_execution.out @@ -705,7 +705,7 @@ SELECT FROM distributed_table, all_data WHERE - distributed_table.key = all_data.key AND distributed_table.key = 1; + distributed_table.key = all_data.key AND distributed_table.key = 1 AND EXISTS (SELECT * FROM all_data); count ------- 1 diff --git a/src/test/regress/expected/local_shard_execution_0.out b/src/test/regress/expected/local_shard_execution_0.out index c5387ad4e..ec0c44e01 100644 --- a/src/test/regress/expected/local_shard_execution_0.out +++ b/src/test/regress/expected/local_shard_execution_0.out @@ -691,7 +691,7 @@ SELECT FROM distributed_table, all_data WHERE - distributed_table.key = all_data.key AND distributed_table.key = 1; + distributed_table.key = all_data.key AND distributed_table.key = 1 AND EXISTS (SELECT * FROM all_data); count ------- 1 diff --git a/src/test/regress/sql/local_shard_execution.sql b/src/test/regress/sql/local_shard_execution.sql index 20212b959..72e36bccd 100644 --- a/src/test/regress/sql/local_shard_execution.sql +++ b/src/test/regress/sql/local_shard_execution.sql @@ -425,7 +425,7 @@ SELECT FROM distributed_table, all_data WHERE - distributed_table.key = all_data.key AND distributed_table.key = 1; + distributed_table.key = all_data.key AND distributed_table.key = 1 AND EXISTS (SELECT * FROM all_data); -- get ready for the next commands