From: | Richard Broersma <richard(dot)broersma(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Altering Domain Constraints on composite types |
Date: | 2010-06-03 16:12:16 |
Message-ID: | AANLkTimoQQC9qHAs-Q3gIX_P10O1zUgebQM3lwndYdnn@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
While playing with domains and composite types, I discovered a problem
when I tried to alter a domain constraint. I don't believe that this
problem exists for traditional types.
for example:
broersr=> insert into tags values ((84,'PDSL',1,''),(84,'P',1, ''),'TEST TAG');
ERROR: invalid regular expression: invalid repetition count(s)
broersr=> \dD
List of domains
Schema | Name | Type |
Modifier | Check
--------+----------------------+-----------------------+----------------------------------------+-------------------------------------------------------
...
public | tag_function | character varying(4) | not null
| CHECK (VALUE::text ~ '^[A-Z]{2-4}$'::text)
...
(11 rows)
broersr=> --oops I made a mistake in the definition of my REGEX
constraint so lets fix it.
broersr=> begin;
BEGIN
broersr=> alter domain tag_function drop constraint valid_tag_function;
ALTER DOMAIN
broersr=> alter domain tag_function add constraint valid_tag_function
check(value ~ E'^[A-Z]{2,4}$');
ERROR: cannot alter type "tag_function" because column "tags"."tag" uses it
broersr=> rollback;
ROLLBACK
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
From | Date | Subject | |
---|---|---|---|
Next Message | Mario Ignacio Rodríguez Cortés | 2010-06-03 16:40:48 | pgbouncer |
Previous Message | Jehan-Guillaume (ioguix) de Rorthais | 2010-06-03 15:11:38 | Re: Lock issues with partitioned table |