pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Bertheau ☭ <twanger@bluetwanger.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Joe Conway <mail@joeconway.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Date: Mon, 06 Jun 2005 16:17:24 +0200
Message-ID: <1118067445.5506.6.camel@dicaprio.akademie1.de> (raw)
In-Reply-To: <16774.1116907560@sss.pgh.pa.us>
References: <1116873219.7306.0.camel@localhost.localdomain>
	<42923762.7010708@joeconway.com>
	<16774.1116907560@sss.pgh.pa.us>

В Втр, 24/05/2005 в 00:06 -0400, Tom Lane пишет:
> Joe Conway <mail@joeconway.com> writes:
> > 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?
> 
> I think he's got a good point, actually.  We document the ARRAY-with-
> parens-around-a-SELECT syntax as
> 
> 	The resulting one-dimensional array will have an element for
> 	each row in the subquery result, with an element type matching
> 	that of the subquery's output column.
> 
> To me, that implies that a subquery result of no rows generates a
> one-dimensional array of no elements, not a null array.

By analogy, array_upper('{}'::TEXT[], 1) should return 0 instead of
NULL.

Markus

-- 
Markus Bertheau ☭ <twanger@bluetwanger.de>




view thread (22+ messages)  latest in thread

Message-ID: <1118067445.5506.6.camel@dicaprio.akademie1.de>
Permalink:  ../1118067445.5506.6.camel@dicaprio.akademie1.de/
Also on:    postgresql.org/message-id/1118067445.5506.6.camel@dicaprio.akademie1.de

 · 

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: twanger@bluetwanger.de, tgl@sss.pgh.pa.us, mail@joeconway.com, pgsql-hackers@postgresql.org
  Subject: Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
  In-Reply-To: <1118067445.5506.6.camel@dicaprio.akademie1.de>

* 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