pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: obouda@email.cz
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #11411: ALTER DOMAIN VALIDATE CONSTRAINT fails if the domain is used in a composite type
Date: Thu, 19 Mar 2015 13:02:34 -0400
Message-ID: <20150319170234.GG6061@momjian.us> (raw)
In-Reply-To: <20140912205148.2488.66328@wrigleys.postgresql.org>
References: <20140912205148.2488.66328@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On Fri, Sep 12, 2014 at 08:51:48PM +0000, obouda@email.cz wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      11411
> Logged by:          Ondřej Bouda
> Email address:      obouda@email.cz
> PostgreSQL version: 9.3.5
> Operating system:   Windows 7 64bit
> Description:        
> 
> The documentation for ALTER DOMAIN notes that "ALTER DOMAIN ADD CONSTRAINT
> and ALTER DOMAIN SET NOT NULL will fail if the named domain or any derived
> domain is used within a composite-type column of any table in the
> database."
> 
> It appears current Postgres also fails on ALTER DOMAIN VALIDATE CONSTRAINT
> in such a case, as demonstrated by the following script:
> 
> CREATE DOMAIN test_domain AS TEXT CONSTRAINT some_check CHECK (TRUE);
> CREATE TYPE test_composite AS (num INT, word test_domain);
> CREATE TABLE test_table (val test_composite);
> ALTER DOMAIN test_domain VALIDATE CONSTRAINT some_check;
> 
> Since the documentation says nothing special regarding ALTER DOMAIN VALIDATE
> CONSTRAINT on a domain used by composite-type columns, the query is expected
> to run without errors.
> 
> Instead, the following error is reported:
> [0A000] ERROR: cannot alter type "test_domain" because column
> "test_table.val" uses it
> 
> It is questionable whether this is an implementation or documentation bug,
> but it certainly is a bug.

Attached doc patch applied.  Thanks for the report.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

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

Attachments:

domain.diff (text/x-diff, 1.1K) download diff --git a/doc/src/sgml/ref/alter_domain.sgml b/doc/src/sgml/ref/alter_domain.sgml new file mode 100644 index f738b29..ac9a5b3 *** a/doc/src/sgml/ref/alter_domain.sgml --- b/doc/src/sgml/ref/alter_domain.sgml *************** ALTER DOMAIN <replaceable class="PARAMET *** 271,279 **** <title>Notes</title> <para> ! Currently, <command>ALTER DOMAIN ADD CONSTRAINT</> and ! <command>ALTER DOMAIN SET NOT NULL</> will fail if the validated named ! domain or any derived domain is used within a composite-type column of any table in the database. They should eventually be improved to be able to verify the new constraint for such nested columns. --- 271,279 ---- <title>Notes</title> <para> ! Currently, <command>ALTER DOMAIN ADD CONSTRAINT</>, <command>ALTER ! DOMAIN VALIDATE CONSTRAINT</>, and <command>ALTER DOMAIN SET NOT NULL</> ! will fail if the validated named domain or any derived domain is used within a composite-type column of any table in the database. They should eventually be improved to be able to verify the new constraint for such nested columns.

view thread (5+ messages)  latest in thread

Message-ID: <20150319170234.GG6061@momjian.us>
Permalink:  ../20150319170234.GG6061@momjian.us/
Also on:    postgresql.org/message-id/20150319170234.GG6061@momjian.us

 ·  · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, obouda@email.cz
  Subject: Re: BUG #11411: ALTER DOMAIN VALIDATE CONSTRAINT fails if the domain is used in a composite type
  In-Reply-To: <20150319170234.GG6061@momjian.us>
  References: <20140912205148.2488.66328@wrigleys.postgresql.org> <20150319170234.GG6061@momjian.us>

* 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