| From: | Nitin Motiani <nitinmotiani(at)google(dot)com> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | [PATCH v1] Fix for bug #19770 : Reject NO INHERIT not-null constraints copied by LIKE to partitioned tables |
| Date: | 2026-10-21 08:32:00 |
| Message-ID: | CAH5HC96YCzOy+9JZLQ4n0sMchVnharTOXrr4sbYuh=_d+ffjAA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
It was reported in [1] that creating a partitioned table by using
'CREATE TABLE .. (LIKE ...)' can lead to a not null constraint with
'NO INHERIT' being copied. This is disallowed for partitioned tables
but the LIKE option has accidentally allowed it.
This seems like an unlikely scenario in practice but since it is
simple to fix, I think we should handle it.
I'm attaching a patch which fixes this by explicitly checking for a
not-null NO INHERIT constraint in transformTableLikeClause and
throwing an error.
Please take a look and let me know what you think.
[1] https://stream.boxwatch.ru/message-id/flat/19770-7c6e75fc30df7e06%40postgresql.org
Thanks & Regards,
Nitin Motiani
Google
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Reject-NO-INHERIT-not-null-constraints-copied-by-.patch | application/x-patch | 7.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-10-21 08:44:05 | Re: [PATCH v1] Fix tab completion for DROP INDEX CONCURRENTLY |
| Previous Message | vignesh C | 2026-10-21 08:26:17 | Re: [PG19] Sequence sync stops when the subscription owner can't SET ROLE to a sequence owner |