pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Joe Conway <mail@joeconway.com>
Cc: Markus Bertheau <twanger@bluetwanger.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Date: Tue, 24 May 2005 09:21:18 +0300 (EEST)
Message-ID: <Pine.LNX.4.44.0505240911160.10967-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <42923762.7010708@joeconway.com>

O Joe Conway Ýãñáøå óôéò May 23, 2005 :

> Markus Bertheau wrote:
> > why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of
> > ARRAY[] resp. '{}'?
> > 
> 
> Why would you expect an empty array instead of a NULL? NULL is what 
> you'd get for other data types -- for example:

One could ask in the same fashion why someone would want a table
if this table contains no rows.

A null value may mean "dont know",
wheras a '{}' (empty) value may mean "empty set".

For instance lets consider the case where an array holds
the factors of a polynomial formula.

An null value might mean that the person defining
the formulas haven't been bothered with this one yet.
An empty value might mean that the person indicates
that has worked on this particular one, but he/she has no data yet.

Ok extreme cases, but to me there is a clean distinction
between a null array and an empty array.

Also what is definately needed is arrays that may contain
null values.

> 
> regression=# SELECT (SELECT 1 WHERE FALSE) IS NULL;
>   ?column?
> ----------
>   t
> (1 row)
> 
> Joe
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq
> 

-- 
-Achilleus




view thread (22+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0505240911160.10967-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0505240911160.10967-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0505240911160.10967-100000@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: achill@matrix.gatewaynet.com, mail@joeconway.com, twanger@bluetwanger.de
  Subject: Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
  In-Reply-To: <Pine.LNX.4.44.0505240911160.10967-100000@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox