Re: [BUGS] BUG #14888: Need to recheck contraints - Mailing list pgsql-bugs

From Piotr Stefaniak
Subject Re: [BUGS] BUG #14888: Need to recheck contraints
Date
Msg-id DB6PR0301MB23743D5463DD6B109FBF61BFF2500@DB6PR0301MB2374.eurprd03.prod.outlook.com
Whole thread Raw
In response to [BUGS] BUG #14888: Need to recheck contraints  (dmigowski@ikoffice.de)
Responses Re: [BUGS] BUG #14888: Need to recheck contraints  (Daniel Migowski <dmigowski@ikoffice.de>)
List pgsql-bugs
On 2017-11-06 06:50, dmigowski@ikoffice.de wrote:
> The is no way to VALIDATE constraints that PostgreSQL already thinks of as
> VALID. I would love a "force" option here, because when disabling all
> triggers there is still the possibility for errors and I would love to check
> our databases for them.
> 
> How do I do it?

This is a feature request, but I need it too.

My work-around is to use a DO statement that iterates over pg_constraint 
to duplicate all interesting constraints giving each a new name and ends 
with a RAISE EXCEPTION 'OK'. If the execution ends with that "error", 
all constraints are valid. I guess you could wrap it into a BEGIN ... 
ROLLBACK to get the same effect.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: dmigowski@ikoffice.de
Date:
Subject: [BUGS] BUG #14888: Need to recheck contraints
Next
From: Daniel Migowski
Date:
Subject: Re: [BUGS] BUG #14888: Need to recheck contraints