execution plan and record variable in dynamic sql

Поиск
Список
Период
Сортировка
От Пушкин Сергей
Тема execution plan and record variable in dynamic sql
Дата
Msg-id op.xqx6jed6gskoan@pushkinsv.ood.local
обсуждение исходный текст
Ответы Re: execution plan and record variable in dynamic sql
Список pgsql-bugs
Hello!

The following code results in error, if executed in one session:


create or replace function exec(sql text)
returns void language plpgsql as $_$
declarer record;
beginexecute sql into r;
-- works ok everytimeraise notice 'r %', r;
-- fails if type of r.status differs from first exec invocation-- making r.status inaccessibleraise notice 'r.status
%',r.status; 
end;
$_$;

select * from exec($$ select 1 as status $$);
select * from exec($$ select 'test' as status $$);

Results:

NOTICE:  r (1)
NOTICE:  r.status 1 exec
------

(1 row)

NOTICE:  r (test)
ERROR:  type of parameter 4 (iso-8859-1) does not match that when preparing
the plan (integer)
Context:  PL/pgSQL function exec(text) line 8 at RAISE


Version:
PostgreSQL 9.4rc1 on x86_64-iso-8859-1-linux-gnu, compiled by gcc (Debian
4.9.2-2) 4.9.2, 64-bit
also checked on PostgreSQL 9.1.9

Thanks!
--
Serge Pushkin



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

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: BUG #12241: uninitialized value $lib_path
Следующее
От: David G Johnston
Дата:
Сообщение: Re: execution plan and record variable in dynamic sql