BUG #11411: ALTER DOMAIN VALIDATE CONSTRAINT fails if the domain is used in a composite type

From: obouda(at)email(dot)cz
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #11411: ALTER DOMAIN VALIDATE CONSTRAINT fails if the domain is used in a composite type
Date: 2014-09-12 20:51:48
Message-ID: 20140912205148.2488.66328@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 11411
Logged by: Ondřej Bouda
Email address: obouda(at)email(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G Johnston 2014-09-13 01:06:21 Re: BUG #11411: ALTER DOMAIN VALIDATE CONSTRAINT fails if the domain is used in a composite type
Previous Message Roman Konoval 2014-09-12 13:42:54 Re: Memory leak during delete with sequential scan