| From: | Christoph Berg <myon(at)debian(dot)org> |
|---|---|
| To: | Luca Vallisa <luca(dot)vallisa(at)gmail(dot)com> |
| Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Self referential foreign keys in partitioned table not working as expected |
| Date: | 2025-04-01 10:18:30 |
| Message-ID: | Z-u9dhA5ikSgOul9@msg.df7cb.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs pgsql-hackers |
Re: Luca Vallisa
> create table test (
> id_1 int4 not null,
> id_2 int4 not null,
> parent_id_1 int4 null,
> primary key (id_1, id_2),
> foreign key (parent_id_1, id_2) references test(id_1, id_2)
> ) partition by list(id_1);
>
> insert into test values (1, 1, null), (1, 2, 1);
Multi-column foreign keys where one column is NULL effectively disable
the FK, this is not specific to partitioned tables. They works as
designed, but best avoid them.
Christoph
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Luca Vallisa | 2025-04-01 10:24:46 | Re: Self referential foreign keys in partitioned table not working as expected |
| Previous Message | Luca Vallisa | 2025-04-01 09:06:13 | Self referential foreign keys in partitioned table not working as expected |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kirill Reshke | 2025-04-01 10:18:55 | Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query). |
| Previous Message | Pavel Stehule | 2025-04-01 10:15:30 | Re: Add partial :-variable expansion to psql \copy |