summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2003-07-30 19:02:18 +0000
committerTom Lane2003-07-30 19:02:18 +0000
commit9ca5c754fbbe099097e1c4a1def2b58225aca363 (patch)
treec0500641da9954f9814c8ed3c1d78450ae5f2cda
parent082df47b2e76464fea8bf249ac3d6269288a6d48 (diff)
Cause ARRAY[] construct to return a NULL array, rather than raising an
error, if any input element is NULL. This is not what we ultimately want, but until arrays can have NULL elements, it will have to do. Patch from Joe Conway.
-rw-r--r--src/backend/executor/execQual.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index c65844b0f89..d2efab0e36f 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.136 2003/07/28 00:09:14 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.137 2003/07/30 19:02:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1603,6 +1603,10 @@ ExecEvalCase(CaseExprState *caseExpr, ExprContext *econtext,
/* ----------------------------------------------------------------
* ExecEvalArray - ARRAY[] expressions
+ *
+ * NOTE: currently, if any input value is NULL then we return a NULL array,
+ * so the ARRAY[] construct can be considered strict. Eventually this will
+ * change; when it does, be sure to fix contain_nonstrict_functions().
* ----------------------------------------------------------------
*/
static Datum
@@ -1642,9 +1646,10 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
dvalues[i++] = ExecEvalExpr(e, econtext, &eisnull, NULL);
if (eisnull)
- ereport(ERROR,
- (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("arrays cannot have NULL elements")));
+ {
+ *isNull = true;
+ return (Datum) 0;
+ }
}
/* setup for 1-D array of the given length */
@@ -1686,9 +1691,10 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
arraydatum = ExecEvalExpr(e, econtext, &eisnull, NULL);
if (eisnull)
- ereport(ERROR,
- (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("arrays cannot have NULL elements")));
+ {
+ *isNull = true;
+ return (Datum) 0;
+ }
array = DatumGetArrayTypeP(arraydatum);