postgresql tries to reuse plan but fails because the (dynamic) query has changed

Поиск
Список
Период
Сортировка
От Alexey Bashtanov
Тема postgresql tries to reuse plan but fails because the (dynamic) query has changed
Дата
Msg-id 52BC1572.9050201@imap.cc
обсуждение исходный текст
Список pgsql-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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: amutu@amutu.com
Дата:
Сообщение: BUG #8701: recover process hang on slave
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: BUG #8676: Bug Money JSON