BUG #17554: when i use rule on table which have serial column, the nextval exec twice.

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #17554: when i use rule on table which have serial column, the nextval exec twice.
Дата
Msg-id 17554-3a1ae834cdb577ac@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #17554: when i use rule on table which have serial column, the nextval exec twice.  (Francisco Olarte <folarte@peoplecall.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17554
Logged by:          Szabolcs Klement
Email address:      szittya314@gmail.com
PostgreSQL version: 14.4
Operating system:   Rocky Linux release 8.5 (Green Obsidian)
Description:

Hi,
(sorry my poor english)
the problem is in 10-14 postgresql too.

this a sample what make gap in sequence:
create table aa (id serial primary key,tt text);
create or replace function fika1(p1 aa) returns boolean language sql as
$body$
    select (p1.id)::boolean;
$body$;
create or replace rule birkman as on insert to aa do select fika1(new);

insert into aa (tt) values ('uu');
select * from aa order by id;

(when inner the function isnt reference a new record, there isnt gap:
create or replace function fika1(p1 aa) returns boolean language sql as
$body$ select true;    $body$;
)

inner the function then p1.id is always X, but after the insert in the new
record is X-1;

i try with plpgsql function:
create or replace function fika1(p1 aa) returns boolean language plpgsql
as
$body$
  begin
      raise notice 'id:%', p1.id;
    return true;    --I didnt referenced the new value
  end;
$body$;

Best regards
Szabolcs


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

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Excessive number of replication slots for 12->14 logical replication
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: BUG #17552: pg_stat_statements tracks internal FK check queries when COPY used to load data