From: Joe Conway <mail@joeconway.com>
To: m.overmeyer@yahoo.ca
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #14289: Potential bug: "invalid attribute number" when dblink result is assigned in PL/PGSQL
Date: Thu, 18 Aug 2016 14:25:27 -0400
Message-ID: <ac370d6f-19eb-19b5-84a8-acc4f88546c6@joeconway.com> (raw)
In-Reply-To: <20160818174414.1529.37913@wrigleys.postgresql.org>
References: <20160818174414.1529.37913@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 08/18/2016 01:44 PM, m.overmeyer@yahoo.ca wrote:
> The following bug has been logged on the website:
>
> 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:
>
> 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:
>
> 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
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development
Attachments:
signature.asc (application/pgp-signature, 835B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: mail@joeconway.com, m.overmeyer@yahoo.ca
Subject: Re: BUG #14289: Potential bug: "invalid attribute number" when dblink result is assigned in PL/PGSQL
In-Reply-To: <ac370d6f-19eb-19b5-84a8-acc4f88546c6@joeconway.com>
References: <20160818174414.1529.37913@wrigleys.postgresql.org> <ac370d6f-19eb-19b5-84a8-acc4f88546c6@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox