Re: NULL in arrays - Mailing list pgsql-bugs

From Dennis Bjorklund
Subject Re: NULL in arrays
Date
Msg-id Pine.LNX.4.44.0401152132200.17187-100000@zigo.dhs.org
Whole thread Raw
In response to Re: NULL in arrays  (Joe Conway <mail@joeconway.com>)
Responses Re: NULL in arrays
Re: NULL in arrays
List pgsql-bugs
On Thu, 15 Jan 2004, Joe Conway wrote:

> Additionally, this behavior was discussed during the 7.4 development and
> beta cycles on at least a couple occassions -- that would have been the
> time to complain, not now.

Well, I will complain whenever I see something I don't like :-) Just
because I did not read the above thread does not mean I will be quiet for
ever after. You can of course disagree and I have no trouble with that.

> For example, see this thread during beta:
> http://archives.postgresql.org/pgsql-hackers/2003-07/msg00747.php

I've been reading that now. I still don't understand what one gains by
transforming arrays with a null value inside into just a null value.

> > Given the present lack of support for null elements in arrays, it's
> > impossible to have any really pleasant behavior in cases like this.
> > But I don't see an inherent reason why "raise an error" is better than
> > "return a null array".
>
> In fact, the above referenced thread shows a scenario where the former
> behavior is unpleasant.

What I saw in that thread was problems with STRICT and that the function
got inlined because ARRAY[] was assumed to be strict. ARRAY[] is not
strict if it produce an error when one of the elements are NULL, and this
this inlining was invalid, not anything else.

The reason I assumed it was a bug was that I did not see any gain of
allowing it to transforming arrays with NULL inside, into a NULL array. To
me this is as logical as transforming invalid integers into NULL values
and not into errors. Also I didn't see it in the documentation which
further convinced me it was a bug.

In the documentation I got the impression that NULL values inside an array
was not allowed. Now I know that you are allowed to form such an
expression and that it evaluates to the NULL array. The documentation
should be fixed then (or maybe it is documented buy i've not seen it).

--
/Dennis Björklund

pgsql-bugs by date:

Previous
From: Craig Ruff
Date:
Subject: 7.3.5 initdb failure on Irix 6.5.18
Next
From: Tom Lane
Date:
Subject: Re: NULL in arrays