Re: NOT ENFORCED constraint feature - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: NOT ENFORCED constraint feature
Date
Msg-id 202502041422.dpg233g3z5i4@alvherre.pgsql
Whole thread Raw
In response to Re: NOT ENFORCED constraint feature  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
On 2025-Feb-04, Peter Eisentraut wrote:

> On 03.02.25 08:50, Alvaro Herrera wrote:
> > On 2025-Feb-03, Ashutosh Bapat wrote:
> > 
> > > VALID, NOT ENFORCED changed to VALID, ENFORCED - data validation
> > > required, constraint is enforced
> > There's no such thing as a VALID NOT ENFORCED constraint.  It just
> > cannot exist.
> 
> The way I interpret this is that the VALID flag is just recording what would
> happen if the constraint was enforced.  So you you take a [NOT] VALID
> ENFORCED constraint and switch it to NOT ENFORCED and back and you get back
> to where you started.

I think it is dangerous.  You can easily end up with undetected
violating rows in the table, and then you won't be able to dump/restore
it anymore.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"After a quick R of TFM, all I can say is HOLY CR** THAT IS COOL! PostgreSQL was
amazing when I first started using it at 7.2, and I'm continually astounded by
learning new features and techniques made available by the continuing work of
the development team."
Berend Tober, http://archives.postgresql.org/pgsql-hackers/2007-08/msg01009.php



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: NOT ENFORCED constraint feature
Next
From: Álvaro Herrera
Date:
Subject: Re: Better title output for psql \dt \di etc. commands