Prepared statement is not re-parsed after used type is re-created -ERROR: cache lookup failed for type NNN

Поиск
Список
Период
Сортировка
От Rashid Abzalov
Тема Prepared statement is not re-parsed after used type is re-created -ERROR: cache lookup failed for type NNN
Дата
Msg-id CACrSCdHQndjyWQVAO9Ksh_SASHtoWqWnkG1WkPWvHstbetzPQg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Prepared statement is not re-parsed after used type is re-created - ERROR: cache lookup failed for type NNN  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Prepared statement is not re-parsed after used type is re-created. While the re-creation of other types of objects (for example, a table or a function) works correctly.

According to the documentation, the prepared statement was to be re-analyzed again:
PostgreSQL will force re-analysis and re-planning of the statement before using it whenever database objects used in the statement have undergone definitional (DDL) changes since the previous use of the prepared statement.

Tested on 11.2 and 9.6.12.

Steps to reproduce:
1) Create type and function:
create type pg_temp.temp_type AS (field varchar(64));

create function pg_temp.test_func(param pg_temp.temp_type) returns temp_type as $$
begin
  param.field = 'qqq';
  return param;
end;
$$ language plpgsql;

2) Prepare and use them:
PREPARE testplan (pg_temp.temp_type) AS
    select * from pg_temp.test_func($1);
EXECUTE testplan(('(qqq)')::pg_temp.temp_type);

3) Drop type and function:
drop function pg_temp.test_func(param pg_temp.temp_type);
drop type pg_temp.temp_type;

4) Recreate type and function:
create type pg_temp.temp_type as (field varchar(64));

create function pg_temp.test_func(param pg_temp.temp_type) returns temp_type as $$
begin
  param.field = 'qqq';
  return param;
end;
$$ language plpgsql;

5) Trying execute prepared SQL:
EXECUTE testplan(('(qqq)')::pg_temp.temp_type);

ERROR: cache lookup failed for type 2906443

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

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Current HEAD creates dumps that can't be loaded
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Prepared statement is not re-parsed after used type is re-created - ERROR: cache lookup failed for type NNN