From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Yasuo Honda <yasuo(dot)honda(at)gmail(dot)com> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: CREATE TABLE NOT VALID for check and foreign key |
Date: | 2025-01-14 17:46:59 |
Message-ID: | 202501141746.ztgtjtjcehr3@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2025-Jan-08, Alvaro Herrera wrote:
> On 2025-Jan-07, Yasuo Honda wrote:
>
> > I'd like PostgreSQL to raise errors and/or warnings for the NOT VALID
> > check constraint for CREATE TABLE.
> > Ruby on Rails supports creating check constraints with the NOT VALID
> > option and I was not aware that it is just ignored until
> > https://github.com/rails/rails/issues/53732 issue is reported.
>
> Thanks. I left a comment there. I think raising a WARNING might work.
I think it'd be something like the rough POC here. I didn't add
warnings to all the CreateConstraintEntry() because some of them aren't
reachable via a path that allows NOT VALID. However, I may have missed
some cases.
I was really surprised to find that we have no test coverage for the
case where CREATE TABLE specifies a NOT VALID constraint.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Attachment | Content-Type | Size |
---|---|---|
0001-Throw-warning-if-NOT-VALID-is-given-during-CREATE-TA.patch | text/x-diff | 5.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Sami Imseih | 2025-01-14 17:59:48 | Re: New GUC autovacuum_max_threshold ? |
Previous Message | Nathan Bossart | 2025-01-14 17:45:42 | Re: New GUC autovacuum_max_threshold ? |