Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group