pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexey Bashtanov <bashtanov@imap.cc>
To: pgsql-bugs@postgresql.org
Subject: postgresql tries to reuse plan but fails because the (dynamic) query has changed
Date: Thu, 26 Dec 2013 15:39:30 +0400
Message-ID: <52BC1572.9050201@imap.cc> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi, all!

The following behavior found.

[ACTIONS]
execute the following code:
do $$
declare
     a text;
     cur record;
begin
     foreach a in array array['p'] loop
         for cur in execute 'select ' || a || ' r from 
generate_series(3, 3) p' loop
             raise notice '%', cur.r;
         end loop;
     end loop;
     foreach a in array array['p||'',''||p*p'] loop
         for cur in execute 'select ' || a || ' r from 
generate_series(3, 3) p' loop
             raise notice '%', cur.r;
         end loop;
     end loop;
     foreach a in array array['p', 'p||'',''||p*p'] loop
         for cur in execute 'select ' || a || ' r from 
generate_series(3, 3) p' loop
             raise notice '%', cur.r;
         end loop;
     end loop;
end;
$$;

[EXPECTED]
NOTICE:  3
NOTICE:  3,9
NOTICE:  3
NOTICE:  3,9
DO

[RECEIVED]
NOTICE:  3
NOTICE:  3,9
NOTICE:  3
ERROR:  type of parameter 4 (text) does not match that when preparing 
the plan (integer)
CONTEXT:  PL/pgSQL function inline_code_block line 18 at RAISE

[VERSION]
  PostgreSQL 9.3.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 
4.4.7 20120313 (Red Hat 4.4.7-3), 64-bit
  Linux 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 
x86_64 x86_64 GNU/Linux

  also reproduced at postgresql 9.1.9, 9.3.2

[ALSO]
If current behavior is OK, please treat this bugreport as a bugreport on 
documentation.
In what cases record variable is allowed or is not allowed to change its 
structure?

Regards,
  Alexey Bashtanov


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



Message-ID: <52BC1572.9050201@imap.cc>
Permalink:  ../52BC1572.9050201@imap.cc/
Also on:    postgresql.org/message-id/52BC1572.9050201@imap.cc

 · 

reply

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: bashtanov@imap.cc
  Subject: Re: postgresql tries to reuse plan but fails because the (dynamic) query has changed
  In-Reply-To: <52BC1572.9050201@imap.cc>
  References: <52BC1572.9050201@imap.cc>

* 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