RE: Table refer leak in logical replication

Поиск
Список
Период
Сортировка
От houzj.fnst@fujitsu.com
Тема RE: Table refer leak in logical replication
Дата
Msg-id OS0PR01MB571686F75FBDC219FF3DFF0D94769@OS0PR01MB5716.jpnprd01.prod.outlook.com
обсуждение исходный текст
Ответ на Table refer leak in logical replication  ("tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>)
Ответы RE: Table refer leak in logical replication
Re: Table refer leak in logical replication
Список pgsql-hackers
> WARNING: relcache reference leak: relation "xxx" not closed.
>
> Example of the procedure:
> ------publisher------
> create table test (a int primary key);
> create publication pub for table test;
>
> ------subscriber------
> create table test (a int primary key);
> create subscription sub connection 'dbname=postgres' publication pub;
> create function funcA() returns trigger as $$ begin return null; end; $$ language
> plpgsql; create trigger my_trig after insert or update or delete on test for each
> row execute procedure funcA(); alter table test enable replica trigger my_trig;
>
> ------publisher------
> insert into test values (6);
>
> It seems an issue about reference leak. Anyone can fix this?

It seems ExecGetTriggerResultRel will reopen the target table because it cannot find an existing one.
Storing the opened table in estate->es_opened_result_relations seems solves the problem.

Attaching a patch that fix this.
BTW, it seems better to add a testcase for this ?

Best regards,
houzj

Вложения

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

Предыдущее
От: "tanghy.fnst@fujitsu.com"
Дата:
Сообщение: Table refer leak in logical replication
Следующее
От: "shiy.fnst@fujitsu.com"
Дата:
Сообщение: RE: Table refer leak in logical replication