Empty array IS NULL?

From: Markus Bertheau <twanger(at)bluetwanger(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Empty array IS NULL?
Date: 2004-06-28 16:01:54
Message-ID: 1088438514.3239.97.camel@dicaprio.akademie1.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

is the empty array representable in PostgreSQL, and is it
distinguishable from NULL?

oocms=# SELECT ARRAY[1, 2];
array
-------
{1,2}
(1 запись)

oocms=# SELECT '{1, 2}'::INT[];
int4
-------
{1,2}
(1 запись)

oocms=# SELECT ARRAY[];
ERROR: syntax error at or near "]" at character 14
oocms=# SELECT '{}'::INT[];
int4
------
{}
(1 запись)

oocms=# SELECT ARRAY(SELECT 1 UNION SELECT 2);
?column?
----------
{1,2}
(1 запись)

oocms=# SELECT ARRAY(SELECT 1 WHERE FALSE);
?column?
----------

(1 запись)

--
Markus Bertheau <twanger(at)bluetwanger(dot)de>

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2004-06-28 16:26:27 Re: Empty array IS NULL?
Previous Message Duane 2004-06-28 14:26:20 URGENT - Need the DATA TYPES comparison for PostgreSQL and ORACLE and SQL Server