Question about domains. - Mailing list pgsql-sql

From Dmitriy Igrishin
Subject Question about domains.
Date
Msg-id AANLkTimJ41uGheKYOX3xjuz_CdeLUdruizay6BP4jjZw@mail.gmail.com
Whole thread Raw
Responses Re: Question about domains.  (Vibhor Kumar <vibhor.kumar@enterprisedb.com>)
List pgsql-sql
Hey all,<br /><br />Is there a way to add constraint to the domain that used by a composite type<br />that used by a
table?E.g.:<br /><br />CREATE DOMAIN superid AS integer;<br /><br />CREATE TYPE idtype AS<br />(<br />  id superid<br
/>);<br/><br />CREATE TABLE mytab (id idtype NOT NULL);<br /><br />ALTER DOMAIN superid ADD CONSTRAINT superid_check
CHECK(VALUE > 0);<br /><br />ALTER DOMAIN superid DROP CONSTRAINT superid_check;<br /><br />produces the following
output:<br/><br />dmitigr=> CREATE DOMAIN<br />Time: 23,809 ms<br />dmitigr=> CREATE TYPE<br />Time: 44,875 ms<br
/>dmitigr=>CREATE TABLE<br />Time: 134,101 ms<br />dmitigr=> ERROR:  cannot alter type "superid" because column
"mytab"."id"uses it<br /> dmitigr=> ALTER DOMAIN<br />Time: 0,270 ms<br /><br />As you can see, adding constraint to
thedomain produces an error, while dropping<br />constraint is possible!<br />Any comments?<br /><br />Regards,<br
/>Dmitriy<br/> 

pgsql-sql by date:

Previous
From: silly sad
Date:
Subject: Re:
Next
From: Justin Graf
Date:
Subject: Re: strangest thing happened