aboutsummaryrefslogtreecommitdiff
path: root/src/backend/partitioning/partprune.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/partitioning/partprune.c')
-rw-r--r--src/backend/partitioning/partprune.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitioning/partprune.c
index 2ed1e44c181..2ee47b8c8a9 100644
--- a/src/backend/partitioning/partprune.c
+++ b/src/backend/partitioning/partprune.c
@@ -2059,7 +2059,7 @@ match_clause_to_partition_key(GeneratePruningStepsContext *context,
* nodes, one for each array element (excepting nulls).
*/
Const *arr = (Const *) rightop;
- ArrayType *arrval = DatumGetArrayTypeP(arr->constvalue);
+ ArrayType *arrval;
int16 elemlen;
bool elembyval;
char elemalign;
@@ -2068,6 +2068,11 @@ match_clause_to_partition_key(GeneratePruningStepsContext *context,
int num_elems,
i;
+ /* If the array itself is null, the saop returns null */
+ if (arr->constisnull)
+ return PARTCLAUSE_MATCH_CONTRADICT;
+
+ arrval = DatumGetArrayTypeP(arr->constvalue);
get_typlenbyvalalign(ARR_ELEMTYPE(arrval),
&elemlen, &elembyval, &elemalign);
deconstruct_array(arrval,