From: M.Mamin@intershop.de
To: pgsql-bugs@postgresql.org
Subject: BUG #8833: nested dynamic cursors may lead to type mismatch compared to the initial plan
Date: Tue, 14 Jan 2014 16:51:28 +0000
Message-ID: <20140114165128.30128.17990@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 8833
Logged by: Marc Mamin
Email address: M.Mamin@intershop.de
PostgreSQL version: 9.3.2
Operating system: Linux
Description:
Hello,
The example below yelds an error.
To avoid this, it seems that the internal cursor (rec2) should be replanned
dynamically at each iteration (of rec).
Not sure if you would consider it as a bug...
Regards,
Marc Mamin
create temp table t1 (id int, val text);
create temp table t2 (id int8, val text);
insert into t1 values(1,'foo1');
insert into t2 values(1,'foo2');
DO $$
DECLARE
rec record;
rec2 record;
target text;
BEGIN
for rec in select 't1' as tname UNION select 't2' loop
for rec2 in EXECUTE 'select id from '||rec.tname loop
EXECUTE 'select val from '||rec.tname||' where id = '|| rec2.id into
target;
end loop;
end loop;
END;
$$ language plpgsql
ERROR: type of parameter 7 (bigint) does not match that when preparing the
plan (integer)
SQL state: 42804
Context: PL/pgSQL function inline_code_block line 16 at EXECUTE statement
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: M.Mamin@intershop.de
Subject: Re: BUG #8833: nested dynamic cursors may lead to type mismatch compared to the initial plan
In-Reply-To: <20140114165128.30128.17990@wrigleys.postgresql.org>
References: <20140114165128.30128.17990@wrigleys.postgresql.org>
* 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