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 661B552887 for ; Tue, 24 May 2005 03:02:42 -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 35818-04 for ; Tue, 24 May 2005 06:02:37 +0000 (GMT) Received: from web11.manitu.net (web11.manitu.net [217.11.48.111]) by svr1.postgresql.org (Postfix) with ESMTP id 5972B5286C for ; Tue, 24 May 2005 03:02:36 -0300 (ADT) Received: from tschibtschibojtschitsch (dsl-082-082-188-197.arcor-ip.net [82.82.188.197]) (authenticated) by web11.manitu.net (8.10.2-SOL3/8.10.2) with ESMTP id j4O62Re31153; Tue, 24 May 2005 08:02:27 +0200 Subject: Re: ARRAY() returning NULL instead of ARRAY[] resp. {} From: Markus Bertheau To: Tom Lane Cc: Joe Conway , pgsql-sql@postgresql.org 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> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-i6yZVA3SXsNrNAvBJqE3" Date: Tue, 24 May 2005 08:02:25 +0200 Message-Id: <1116914546.7306.0.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.132 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/195 X-Sequence-Number: 21508 --=-i6yZVA3SXsNrNAvBJqE3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Dnia 24-05-2005, wto o godzinie 00:06 -0400, Tom Lane napisa=C5=82(a): > Joe Conway writes: > > Markus Bertheau wrote: > >> why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of > >> ARRAY[] resp. '{}'? >=20 > > Why would you expect an empty array instead of a NULL? >=20 > I think he's got a good point, actually. We document the ARRAY-with- > parens-around-a-SELECT syntax as >=20 > 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. >=20 > To me, that implies that a subquery result of no rows generates a > one-dimensional array of no elements, not a null array. >=20 > The point Markus is complaining about seems like it should > be easily fixable. Great :) Is this a TODO? --=20 Markus Bertheau --=-i6yZVA3SXsNrNAvBJqE3 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQBCksNu2RUnMPztcykRAsULAJ9ZRAO32YckhekamYpfqRV+pu6VAgCeIVe5 tf99JAQqKjltbv+A0hpEZE4= =dhis -----END PGP SIGNATURE----- --=-i6yZVA3SXsNrNAvBJqE3--