Re: NULL in arrays

From: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: NULL in arrays
Date: 2004-01-15 21:09:45
Message-ID: Pine.LNX.4.44.0401152132200.17187-100000@zigo.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-01-15 21:22:50 Re: NULL in arrays
Previous Message Craig Ruff 2004-01-15 18:26:04 7.3.5 initdb failure on Irix 6.5.18