X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A77575292A; Mon, 6 Jun 2005 11:44:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94836-05; Mon, 6 Jun 2005 14:44:48 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 427A652906; Mon, 6 Jun 2005 11:44:48 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j56Eiolj025975; Mon, 6 Jun 2005 10:44:50 -0400 (EDT) To: Markus Bertheau =?UTF-8?Q?=E2=98=AD?= Cc: Joe Conway , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: ARRAY() returning NULL instead of ARRAY[] resp. {} In-reply-to: <1118067445.5506.6.camel@dicaprio.akademie1.de> References: <1116873219.7306.0.camel@localhost.localdomain> <42923762.7010708@joeconway.com> <16774.1116907560@sss.pgh.pa.us> <1118067445.5506.6.camel@dicaprio.akademie1.de> Comments: In-reply-to Markus Bertheau =?UTF-8?Q?=E2=98=AD?= message dated "Mon, 06 Jun 2005 16:17:24 +0200" Date: Mon, 06 Jun 2005 10:44:49 -0400 Message-ID: <25974.1118069089@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/81 X-Sequence-Number: 21682 Markus Bertheau =?UTF-8?Q?=E2=98=AD?= 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 shows ... or at least it would be except for an overenthusiastic error check: regression=# select '[1:0]={}' :: int[]; ERROR: upper bound cannot be less than lower bound I think this should be a legal boundary case. In general, it should be possible to form zero-size arrays of any number of dimensions. regards, tom lane