pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14888: Need to recheck contraints
3+ messages / 3 participants
[nested] [flat]

* BUG #14888: Need to recheck contraints
@ 2017-11-06 05:50 dmigowski@ikoffice.de
  2017-11-06 06:48 ` Re: BUG #14888: Need to recheck contraints Piotr Stefaniak <postgres@piotr-stefaniak.me>
  0 siblings, 1 reply; 3+ messages in thread

From: dmigowski@ikoffice.de @ 2017-11-06 05:50 UTC (permalink / raw)
  To: pgsql-bugs; +Cc: dmigowski@ikoffice.de

The following bug has been logged on the website:

Bug reference:      14888
Logged by:          Daniel Migowski
Email address:      dmigowski@ikoffice.de
PostgreSQL version: 9.5.9
Operating system:   doesn&#39;t matter
Description:        

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?


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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14888: Need to recheck contraints
  2017-11-06 05:50 BUG #14888: Need to recheck contraints dmigowski@ikoffice.de
@ 2017-11-06 06:48 ` Piotr Stefaniak <postgres@piotr-stefaniak.me>
  2017-11-06 06:50   ` Re: BUG #14888: Need to recheck contraints Daniel Migowski <dmigowski@ikoffice.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Piotr Stefaniak @ 2017-11-06 06:48 UTC (permalink / raw)
  To: dmigowski@ikoffice.de <dmigowski@ikoffice.de>; 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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14888: Need to recheck contraints
  2017-11-06 05:50 BUG #14888: Need to recheck contraints dmigowski@ikoffice.de
  2017-11-06 06:48 ` Re: BUG #14888: Need to recheck contraints Piotr Stefaniak <postgres@piotr-stefaniak.me>
@ 2017-11-06 06:50   ` Daniel Migowski <dmigowski@ikoffice.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Daniel Migowski @ 2017-11-06 06:50 UTC (permalink / raw)
  To: Piotr Stefaniak <postgres@piotr-stefaniak.me>; pgsql-bugs

Okey, 

my current workaround is just setting convalidated in pg_constraint to false just prior to checking it. Also nice because the constraint stays invalidated until fixed.

Regards,
Daniel Migowski

-----Ursprüngliche Nachricht-----
Von: Piotr Stefaniak [mailto:postgres@piotr-stefaniak.me] 
Gesendet: Montag, 6. November 2017 07:48
An: Daniel Migowski; pgsql-bugs@postgresql.org
Betreff: Re: [BUGS] BUG #14888: Need to recheck contraints

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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-11-06 06:50 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 05:50 BUG #14888: Need to recheck contraints dmigowski@ikoffice.de
2017-11-06 06:48 ` Piotr Stefaniak <postgres@piotr-stefaniak.me>
2017-11-06 06:50   ` Daniel Migowski <dmigowski@ikoffice.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox