Re: Self referential foreign keys in partitioned table not working as expected
| От | Christoph Berg |
|---|---|
| Тема | Re: Self referential foreign keys in partitioned table not working as expected |
| Дата | |
| Msg-id | Z-vD6oJjKqgeST0L@msg.df7cb.de обсуждение |
| Ответ на | Re: Self referential foreign keys in partitioned table not working as expected (Luca Vallisa <luca.vallisa@gmail.com>) |
| Ответы |
Re: Issue attaching a table to a partitioned table with an auto-referenced foreign key
Re: Issue attaching a table to a partitioned table with an auto-referenced foreign key Re: Self referential foreign keys in partitioned table not working as expected |
| Список | pgsql-bugs |
Re: Luca Vallisa
> The provided version throws an error.
Ok, I can confirm this.
This throws an error like it should:
create table test (
id_1 int4 not null,
id_2 int4 not null,
parent_id_2 int4 null,
primary key (id_1, id_2),
foreign key (id_1, parent_id_2) references test (id_1, id_2)
);
insert into test values (1, 1, null), (1, 2, 1);
delete from test where (id_1, id_2) = (1, 1);
On a partitioned table, it does not throw the error:
create table test (
id_1 int4 not null,
id_2 int4 not null,
parent_id_2 int4 null,
primary key (id_1, id_2),
foreign key (id_1, parent_id_2) references test (id_1, id_2)
) partition by list (id_1);
create table test_1 partition of test for values in (1);
insert into test values (1, 1, null), (1, 2, 1);
delete from test where (id_1, id_2) = (1, 1);
Christoph
В списке pgsql-bugs по дате отправления: