Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baS0X-0002n5-5C for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Aug 2016 18:25:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1baS0W-0000Sp-HO for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Aug 2016 18:25:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1baS0V-0000Sa-M1 for pgsql-bugs@postgresql.org; Thu, 18 Aug 2016 18:25:35 +0000 Received: from 104-190-1-44.lightspeed.sndgca.sbcglobal.net ([104.190.1.44] helo=joeconway.com) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baS0S-0000YS-Jj for pgsql-bugs@postgresql.org; Thu, 18 Aug 2016 18:25:34 +0000 Received: from [108.225.169.28] (account jconway@joeconway.com HELO [192.168.1.81]) by joeconway.com (CommuniGate Pro SMTP 6.1.4) with ESMTPSA id 16885404; Thu, 18 Aug 2016 11:25:31 -0700 Subject: Re: BUG #14289: Potential bug: "invalid attribute number" when dblink result is assigned in PL/PGSQL To: m.overmeyer@yahoo.ca, pgsql-bugs@postgresql.org References: <20160818174414.1529.37913@wrigleys.postgresql.org> From: Joe Conway Openpgp: id=4EA5B4659ED59CC9538139A5332B7E68B699434A Message-ID: Date: Thu, 18 Aug 2016 14:25:27 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160818174414.1529.37913@wrigleys.postgresql.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BnR4xp7extj4Iv6FGwm0gitQ2wC7QhX3Q" X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BnR4xp7extj4Iv6FGwm0gitQ2wC7QhX3Q From: Joe Conway To: m.overmeyer@yahoo.ca, pgsql-bugs@postgresql.org Message-ID: Subject: Re: [BUGS] BUG #14289: Potential bug: "invalid attribute number" when dblink result is assigned in PL/PGSQL References: <20160818174414.1529.37913@wrigleys.postgresql.org> In-Reply-To: <20160818174414.1529.37913@wrigleys.postgresql.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/18/2016 01:44 PM, m.overmeyer@yahoo.ca wrote: > The following bug has been logged on the website: >=20 > Bug reference: 14289 > Logged by: Michael Overmeyer > Email address: m.overmeyer@yahoo.ca > PostgreSQL version: 9.5.4 > Operating system: CentOS 7, also Docker > Description:=20=20=20=20=20=20=20=20 >=20 > I believe I may have found a bug in PL/PGSQL or dblink. When using the > assignment operator to assign the results of dblink_build_sql_delete to a > variable, it gives me: >=20 > psql:pg_bug.sql:37: ERROR: 22023: invalid attribute number -1598 > CONTEXT: PL/pgSQL function test_assignment(int2vector) line 6 at > assignment > LOCATION: validate_pkattnums, dblink.c:2851 This does not have anything specific to do with dblink -- but it does seem to be specific to plpgsql. Here is a minimal test case: SELECT version(); version -------------------------------------------------------------------- PostgreSQL 9.5.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit (1 row) CREATE OR REPLACE FUNCTION test_int2vector(pka int2vector) RETURNS int2vector AS $$ BEGIN return pka; END; $$ LANGUAGE plpgsql; SELECT test_int2vector('1'::int2vector); -- garbage result CREATE OR REPLACE FUNCTION test_int2v(pka int2vector) RETURNS int2vector AS $$ select pka $$ LANGUAGE sql; SELECT test_int2v('1'::int2vector); -- works fine --=20 Crunchy Data - http://crunchydata.com PostgreSQL Support for Secure Enterprises Consulting, Training, & Open Source Development --BnR4xp7extj4Iv6FGwm0gitQ2wC7QhX3Q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXtf2XAAoJEDfy90M199hlZ2IP/A8/nEzljtI3Dgpcpn/Mvl4T PfZmWgpXsntlZ532S0OMTh8TJzRWAQH7UXm3hL5cMuTvaxR6t9cJXT+Ib4nFBchD q6/gA8RF9xQjReJe4TTxqHfs+BSg6jjDXnGMeAui80eeH8pMJ8AXJwI7Qh9pd0PW 4/m0nLA4ufyOXtEy5/AuqwuRWl9kKrhA1/3rAM5GsPz8usedgtCqvrsSQEWEVzw8 QsX1e4EdhrIE2wEqyYcFgQzBTZb+DCtUiLvmYa9Q3H4UVMQYHIDoB3wlH2QJpjz4 kwSSFLuKOQ69FTrfJNkK6vnK/jVwoRewRB+1n94tEJouqQyAEbQId9DpE+Wmj9Jg g1u7Yri4HCVw9Rq+7hocZ879UsB0tptuxR8R9we4usnv70pj3ggkqqhZH3KUQJ/a 9ZZMo/olLysWXcw9g+jo0PsB/YwSYuKLwZ+7bdZmNhKOuQ1pdrud8h6lPJ1/35cg RgntQQNkN9V2M6Y9VsBXTR/FvKEvi7nPoiWUzc9yCcRjtese1544bKiMPGEOIKY8 0GAEkqBZLzixZk+CmpWbaGvLVKoTAoSMisSmfGPftf4QdOR0vqeDWUi4cMA2g8D1 5OiJUGs4FnfG0oCtx65aMwB4ZC+rdcCFgKkdnbBKB4Wvqx8Uhk6+QEwplYvzEvxg miU/2gyS6XI+3PqgyRDp =wfri -----END PGP SIGNATURE----- --BnR4xp7extj4Iv6FGwm0gitQ2wC7QhX3Q--