Re: ARRAY() returning NULL instead of ARRAY[] resp. {}

From: Joe Conway <mail(at)joeconway(dot)com>
To: Markus Bertheau <twanger(at)bluetwanger(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Date: 2005-05-23 20:04:50
Message-ID: 42923762.7010708@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches pgsql-sql

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:

regression=# SELECT (SELECT 1 WHERE FALSE) IS NULL;
?column?
----------
t
(1 row)

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-05-23 20:08:24 Re: Speeding up the Postgres lexer
Previous Message Markus Bertheau 2005-05-23 18:58:11 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2005-05-23 22:16:28 plperl tests for currently untested features
Previous Message Markus Bertheau 2005-05-23 18:58:11 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-05-24 04:06:00 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Previous Message Markus Bertheau 2005-05-23 18:58:11 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}