pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: buschmann@nidsa.net
To: pgsql-bugs@postgresql.org
Subject: BUG #14629: ALTER TABLE VALIDATE CONSTRAINTS does not obey NO INHERIT clause
Date: Fri, 21 Apr 2017 18:40:12 +0000
Message-ID: <20170421184012.24362.19@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14629
Logged by:          Hans Buschmann
Email address:      buschmann@nidsa.net
PostgreSQL version: 9.6.2
Operating system:   Windows x64
Description:        


Given these both tables (orders_archiv inherits orders) on 9.6.2 Windows
x64
(cut/paste from psql)

xxxdb=# \d orders_archiv;
...
Check constraints:
    "ck_or_old" CHECK (or_season < 24) NO INHERIT
Inherits: orders


xxxdb=# \d orders
...
Check constraints:
    "ck_or_new" CHECK (or_season >= 24) NO INHERIT NOT VALID
Triggers:
    tr_orders_insert BEFORE INSERT ON orders FOR EACH ROW WHEN
(new.or_season < 24) EXECUTE PROCEDURE fn_orders_insert()
Number of child tables: 1 (Use \d+ to list them.)


When applying these commands to the parent table, the following errors are
returned:

xxxdb=# alter table orders validate constraint ck_or_new;
ERROR:  constraint "ck_or_new" of relation "orders_archiv" does not exist


xxxdb=# alter table only orders validate constraint ck_or_new;
ERROR:  constraint must be validated on child tables too

Background:
From our original partitioning of quite a lot of tables according to
xx_season columns (a season is a half year period) I dropped and recreated
the check constraintsin a not valid state.

At the end of the script to move the data from 2 seasons into the archiv
tables I tried to reenable the check constraints and encountered those two
errors.

It seems that I can circumvent these errors by recreating the constraints
without the not valid clause.

Do I miss something here ?

Hans Buschmann





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


view thread (4+ messages)  latest in thread

Message-ID: <20170421184012.24362.19@wrigleys.postgresql.org>
Permalink:  ../20170421184012.24362.19@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20170421184012.24362.19@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: buschmann@nidsa.net
  Subject: Re: BUG #14629: ALTER TABLE VALIDATE CONSTRAINTS does not obey NO INHERIT clause
  In-Reply-To: <20170421184012.24362.19@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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