Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E242D1337990 for ; Mon, 15 Nov 2010 06:41:18 -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 97917-07 for ; Mon, 15 Nov 2010 10:41:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og126.obsmtp.com (exprod7og126.obsmtp.com [64.18.2.206]) by mail.postgresql.org (Postfix) with SMTP id 2C0741335B36 for ; Mon, 15 Nov 2010 06:41:10 -0400 (AST) Received: from source ([209.85.215.177]) by exprod7ob126.postini.com ([64.18.6.12]) with SMTP ID DSNKTOEORvpbXEc+lI9CBkXTh0ixuFgGRRoO@postini.com; Mon, 15 Nov 2010 02:41:12 PST Received: by eyd9 with SMTP id 9so2608435eyd.8 for ; Mon, 15 Nov 2010 02:41:10 -0800 (PST) Received: by 10.213.3.11 with SMTP id 11mr2099857ebl.82.1289817669416; Mon, 15 Nov 2010 02:41:09 -0800 (PST) Received: from [192.168.1.183] (dsl-hkibrasgw2-ff7ac300-240.dhcp.inet.fi [88.195.122.240]) by mx.google.com with ESMTPS id v51sm6487195eeh.16.2010.11.15.02.41.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 15 Nov 2010 02:41:08 -0800 (PST) Message-ID: <4CE10E39.9080806@enterprisedb.com> Date: Mon, 15 Nov 2010 12:40:57 +0200 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.1.15) Gecko/20101030 Icedove/3.0.10 MIME-Version: 1.0 To: Yeb Havinga CC: Tom Lane , pgsql-bugs@postgresql.org Subject: Re: BUG #5748: Invalid oidvector data during binary recv References: <201011111430.oABEUVPe067398@wwwmaster.postgresql.org> <15298.1289490490@sss.pgh.pa.us> <4CDC1380.2090309@enterprisedb.com> <4CE10697.3050309@gmail.com> In-Reply-To: <4CE10697.3050309@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.2 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201011/101 X-Sequence-Number: 28681 On 15.11.2010 12:08, Yeb Havinga wrote: > On 2010-11-11 17:02, Heikki Linnakangas wrote: >> On 11.11.2010 17:48, Tom Lane wrote: >>> "Yeb Havinga" writes: >>>> postgres=# create table a as select ''::oidvector; >>>> SELECT 1 >>>> postgres=# copy a to '/tmp/test' with binary; >>>> COPY 1 >>>> postgres=# copy a from '/tmp/test' with binary; >>>> ERROR: invalid oidvector data >>> >>> The problem seems to be that array_recv passes back a zero-dimensional >>> array, *not* a 1-D array, when it observes that the input has no >>> elements. A zero-D array is not part of the subset of possible arrays >>> that we allow for oidvector. >> >> Yeah, I just reached that conclusion too.. > The patch below changes array_recv, so that it returns an empty 1-D > array when an empty 1-D array was written binary. No changes in > oidvectorrecv or int2vectorrecv are needed. That seems like a bad idea. array_in() represents an empty array with zero dimensions, we're not going to change the generic array_recv() function used for all arrays to behave differently because of some corner-case in oidvectorrecv. If we want do anything about this, the right fix is to add a special case in oidvectorrecv/int2vectorrecv to handle empty array. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com