Tom Lane wrote:
Joe Conway <[EMAIL PROTECTED]> 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);
  
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to