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

2005-06-06 Thread Markus Bertheau ☭
, 24/05/2005 00:06 -0400, Tom Lane : Joe Conway [EMAIL PROTECTED] 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.

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

2005-06-06 Thread Tom Lane
Markus Bertheau =?UTF-8?Q?=E2=98=AD?= [EMAIL PROTECTED] writes: By analogy, array_upper('{}'::TEXT[], 1) should return 0 instead of NULL. No, that doesn't follow ... we've traditionally considered '{}' to denote a zero-dimensional array. A 1-D array of no elements is '[1:0]={}', just as Joe

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

2005-06-06 Thread Joe Conway
Tom Lane wrote: Markus Bertheau =?UTF-8?Q?=E2=98=AD?= [EMAIL PROTECTED] writes: By analogy, array_upper('{}'::TEXT[], 1) should return 0 instead of NULL. No, that doesn't follow ... we've traditionally considered '{}' to denote a zero-dimensional array. A 1-D array of no elements is

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

2005-06-04 Thread Bruce Momjian
Joe Conway wrote: Tom Lane wrote: 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

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

2005-06-04 Thread Joe Conway
Bruce Momjian wrote: Joe Conway wrote: Any thoughts on how this should be handled for an empty 1D array? No one responed to this email, so I will try. Is this the one dimmentional array you were talking about? test= select array_dims('{}'::integer[]); array_dims

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

2005-06-04 Thread Bruce Momjian
Joe Conway wrote: Bruce Momjian wrote: Joe Conway wrote: Any thoughts on how this should be handled for an empty 1D array? No one responed to this email, so I will try. Is this the one dimmentional array you were talking about? test= select array_dims('{}'::integer[]);

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

2005-05-26 Thread Joe Conway
Tom Lane wrote: 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

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

2005-05-24 Thread Markus Bertheau
Dnia 24-05-2005, wto o godzinie 00:06 -0400, Tom Lane napisa(a): Joe Conway [EMAIL PROTECTED] 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

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

2005-05-24 Thread Achilleus Mantzios
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

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

2005-05-23 Thread Markus Bertheau
Hi, why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of ARRAY[] resp. '{}'? Markus -- Markus Bertheau [EMAIL PROTECTED] signature.asc Description: This is a digitally signed message part

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

2005-05-23 Thread Jan B.
Markus Bertheau wrote: Hi, why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of ARRAY[] resp. '{}'? Markus Perhaps Arrays always have to contain at least one element? (I don't know for sure.) SELECT array[]; ERROR: syntax error at or near ] at character 14 LINE 1: SELECT

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

2005-05-23 Thread Markus Bertheau
Dnia 23-05-2005, pon o godzinie 18:54 +, Jan B. napisa(a): Perhaps Arrays always have to contain at least one element? (I don't know for sure.) They can: template1=# select '{}'::TEXT[]; text -- {} (1 ) I don't know, why the ARRAY[] syntax doesn't work for empty arrays. Markus

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

2005-05-23 Thread Tom Lane
Joe Conway [EMAIL PROTECTED] 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-