Re: NULL in arrays

From: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: NULL in arrays
Date: 2004-01-15 16:13:40
Message-ID: Pine.LNX.4.44.0401151710510.17187-100000@zigo.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 15 Jan 2004, Tom Lane wrote:

> > dennis=# INSERT INTO foo VALUES (ARRAY[2,NULL]);
> > INSERT 25353 1
>
> > That last insert contains a NULL value which are not allowed in arrays and
> > yet a insert is performed. The table contains a NULL value afterwards
> > (and no array).
>
> As we used to say at HP, this is not a bug, it's a definition
> disagreement. You need to give a coherent argument why we should
> change, not just claim it's wrong.
>
> Given the present lack of support for null elements in arrays, it's
> impossible to have any really pleasant behavior in cases like this.

This is the reason, you are not allowed to store NULL in arrays. Why
should you not give an error if someone tries to do that anyway.

> But I don't see an inherent reason why "raise an error" is better than
> "return a null array".

If you try to insert the value 'goofy' in a integer column, would you
expect an error or that you get the value NULL inserted?

--
/Dennis Björklund

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Joe Conway 2004-01-15 18:21:38 Re: NULL in arrays
Previous Message Richard Huxton 2004-01-15 15:57:48 Re: BUG #1049: Invalid SQL Executed as JDBC Prepared Statement still executes embedded SQL