BUG #15456: Trigger function using ROW(NEW.*) has wrong columns iftable is modified during a session

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #15456: Trigger function using ROW(NEW.*) has wrong columns iftable is modified during a session
Дата
Msg-id 15456-ac99771a43cdd95e@postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15456
Logged by:          Sean Johnston
Email address:      sean.johnston@edgeintelligence.com
PostgreSQL version: 11.0
Operating system:   Ubuntu 14.04
Description:

-- 1. create trigger function

create or replace function trig() returns trigger as $$
begin
  if TG_OP = 'INSERT' then
    raise notice 'INSERT: %', ROW(NEW.*);
  end if;
  return null;
end $$ language plpgsql;

-- 2. create table

drop table if exists t;
create table t (id integer) tablespace pg_default;

-- 3. create a trigger on the table for each row

create trigger do_trig
after insert or update or delete on t
for each row
  execute procedure trig();

-- 4. insert a row

insert into t(id) values (1);

-- 5. add a column to the table

alter table t add val text;

-- 6. insert a new row referencing the new column

insert into t(id,val) values (2,'new');

------

Output from notices:
psql:1.sql:18: NOTICE:  INSERT: (1)
psql:1.sql:22: NOTICE:  INSERT: (2)

Expected output:
psql:1.sql:18: NOTICE:  INSERT: (1)
psql:1.sql:22: NOTICE:  INSERT: (2,new)

Note that if a new session is started before performing the second insert
then the expected output is produced.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Can't start postgresql 11
Следующее
От: Amit Langote
Дата:
Сообщение: Re: postgres 11.0 partition table works unexpected in update