Re: CREATE TABLE NOT VALID for check and foreign key

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-08 13:36:08
Message-ID: 202501081336.5ntcq5oar24r@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

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.

> Rails has implemented a kind of workaround by not dumping the NOT
> VALID option, but it does not help for the first execution.
> https://github.com/rails/rails/pull/53735

Yeah, that's probably not ideal.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"You're _really_ hosed if the person doing the hiring doesn't understand
relational systems: you end up with a whole raft of programmers, none of
whom has had a Date with the clue stick." (Andrew Sullivan)
https://postgr.es/m/20050809113420.GD2768@phlogiston.dyndns.org

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-01-08 13:39:26 Re: Moving the vacuum GUCs' docs out of the Client Connection Defaults section
Previous Message Hayato Kuroda (Fujitsu) 2025-01-08 13:35:51 RE: ecpg command does not warn COPY ... FROM STDIN;