Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 85EDC1337B49 for ; Mon, 15 Nov 2010 13:24:38 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 73221-07 for ; Mon, 15 Nov 2010 17:24:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 12B7F1337990 for ; Mon, 15 Nov 2010 13:24:30 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id oAFHOQ7D016688; Mon, 15 Nov 2010 12:24:26 -0500 (EST) To: Greg Stark cc: Yeb Havinga , Heikki Linnakangas , pgsql-bugs@postgresql.org Subject: Re: BUG #5748: Invalid oidvector data during binary recv In-reply-to: References: <201011111430.oABEUVPe067398@wwwmaster.postgresql.org> <15298.1289490490@sss.pgh.pa.us> <4CDC1380.2090309@enterprisedb.com> <4CE10697.3050309@gmail.com> <4CE10E39.9080806@enterprisedb.com> <4CE111D6.5070801@gmail.com> <14024.1289834527@sss.pgh.pa.us> <16032.1289839906@sss.pgh.pa.us> Comments: In-reply-to Greg Stark message dated "Mon, 15 Nov 2010 17:11:08 +0000" Date: Mon, 15 Nov 2010 12:24:26 -0500 Message-ID: <16687.1289841866@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/106 X-Sequence-Number: 28686 Greg Stark writes: > Is this the same question as split() on enmpty strings? Do we have a > problem distinguishing between a 0-dimensional array and a > 1-dimensional empty array? Internally they're certainly different. I've just been sniffing around the code a bit, and the main problem I see with trying to be more rigorous about this is that array_out just prints '{}' for any zero-element array, regardless of the recorded dimensionality. We could reserve that notation to mean a 0-D array (which is what array_in reads it as). But then we have to figure out what to print for other cases. The only good idea that comes to mind is [1:0]={} (or variants of that depending on what the stored dimensions actually are). array_in currently rejects that: regression=# select '[1:0]={}'::int[]; ERROR: upper bound cannot be less than lower bound but perhaps it wouldn't be too painful to tweak it to allow the case. It appears to be fairly hard to actually get a non-zero-D empty array into the system, so while this is pretty ugly I think it wouldn't affect common usage. Comments? regards, tom lane