aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/plan/initsplan.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index 1d1aa27d450..01804b085b3 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -3109,6 +3109,13 @@ restriction_is_always_true(PlannerInfo *root,
if (nulltest->nulltesttype != IS_NOT_NULL)
return false;
+ /*
+ * Empty rows can appear NULL in some contexts and NOT NULL in others,
+ * so avoid this optimization for row expressions.
+ */
+ if (nulltest->argisrow)
+ return false;
+
return expr_is_nonnullable(root, nulltest->arg);
}
@@ -3167,6 +3174,13 @@ restriction_is_always_false(PlannerInfo *root,
if (nulltest->nulltesttype != IS_NULL)
return false;
+ /*
+ * Empty rows can appear NULL in some contexts and NOT NULL in others,
+ * so avoid this optimization for row expressions.
+ */
+ if (nulltest->argisrow)
+ return false;
+
return expr_is_nonnullable(root, nulltest->arg);
}