summaryrefslogtreecommitdiff
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 3b21f8ae596..0d748973a4e 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -2758,6 +2758,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);
}
@@ -2816,6 +2823,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);
}