Add GUC for queries with outer joins and pseudoconstant quals (#8163)

Users can turn on this GUC at their own risk.
pull/8172/head
Naisila Puka 2025-08-27 22:31:22 +03:00 committed by naisila
parent d31e3d371f
commit 67cd59bf24
3 changed files with 21 additions and 1 deletions

View File

@ -92,6 +92,8 @@
#include "distributed/shard_pruning.h"
#include "distributed/version_compat.h"
bool EnableOuterJoinsWithPseudoconstantQualsPrePG17 = false;
/*
* RecursivePlanningContext is used to recursively plan subqueries
* and CTEs, pull results to the coordinator, and push it back into
@ -483,7 +485,7 @@ ShouldRecursivelyPlanOuterJoins(Query *query, RecursivePlanningContext *context)
bool hasOuterJoin =
context->plannerRestrictionContext->joinRestrictionContext->hasOuterJoin;
if (!hasOuterJoin)
if (!EnableOuterJoinsWithPseudoconstantQualsPrePG17 && !hasOuterJoin)
{
/*
* PG15 commit d1ef5631e620f9a5b6480a32bb70124c857af4f1

View File

@ -1404,6 +1404,23 @@ RegisterCitusConfigVariables(void)
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE,
NULL, NULL, NULL);
DefineCustomBoolVariable(
"citus.enable_outer_joins_with_pseudoconstant_quals_pre_pg17",
gettext_noop("Enables running distributed queries with outer joins "
"and pseudoconstant quals pre PG17."),
gettext_noop("Set to false by default. If set to true, enables "
"running distributed queries with outer joins and "
"pseudoconstant quals, at user's own risk, because "
"pre PG17, Citus doesn't have access to "
"set_join_pathlist_hook, which doesn't guarantee correct"
"query results. Note that in PG17+, this GUC has no effect"
"and the user can run such queries"),
&EnableOuterJoinsWithPseudoconstantQualsPrePG17,
false,
PGC_USERSET,
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE,
NULL, NULL, NULL);
DefineCustomBoolVariable(
"citus.enable_repartition_joins",
gettext_noop("Allows Citus to repartition data between nodes."),

View File

@ -20,6 +20,7 @@
#include "distributed/log_utils.h"
#include "distributed/relation_restriction_equivalence.h"
extern bool EnableOuterJoinsWithPseudoconstantQualsPrePG17;
typedef struct RecursivePlanningContextInternal RecursivePlanningContext;
typedef struct RangeTblEntryIndex