array expression NULL fix [was: [HACKERS] odd behavior/possible bug]
От | Joe Conway |
---|---|
Тема | array expression NULL fix [was: [HACKERS] odd behavior/possible bug] |
Дата | |
Msg-id | 3F205E54.9070804@joeconway.com обсуждение исходный текст |
Ответы |
Re: array expression NULL fix [was: [HACKERS] odd behavior/possible bug]
|
Список | pgsql-patches |
Tom Lane wrote: > Joe Conway <mail@joeconway.com> writes: >>That probably makes good sense, at least until we can deal with NULL >>elements. Would that patch count as a bug fix? > > Either one would count as a bug fix IMHO. Anyone else have an opinion > on which to do? Here's a patch that replaces the ERROR with a NULL return value when an element in an array expression is NULL. Joe Index: src/backend/executor/execQual.c =================================================================== RCS file: /opt/src/cvs/pgsql-server/src/backend/executor/execQual.c,v retrieving revision 1.135 diff -c -r1.135 execQual.c *** src/backend/executor/execQual.c 21 Jul 2003 17:05:08 -0000 1.135 --- src/backend/executor/execQual.c 24 Jul 2003 22:44:44 -0000 *************** *** 1642,1650 **** dvalues[i++] = ExecEvalExpr(e, econtext, &eisnull, NULL); if (eisnull) ! ereport(ERROR, ! (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), ! errmsg("arrays cannot have NULL elements"))); } /* setup for 1-D array of the given length */ --- 1642,1651 ---- dvalues[i++] = ExecEvalExpr(e, econtext, &eisnull, NULL); if (eisnull) ! { ! *isNull = true; ! return (Datum) 0; ! } } /* setup for 1-D array of the given length */ *************** *** 1686,1694 **** arraydatum = ExecEvalExpr(e, econtext, &eisnull, NULL); if (eisnull) ! ereport(ERROR, ! (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), ! errmsg("arrays cannot have NULL elements"))); array = DatumGetArrayTypeP(arraydatum); --- 1687,1696 ---- arraydatum = ExecEvalExpr(e, econtext, &eisnull, NULL); if (eisnull) ! { ! *isNull = true; ! return (Datum) 0; ! } array = DatumGetArrayTypeP(arraydatum);
В списке pgsql-patches по дате отправления: