Re: Type modifiers for DOMAIN - Mailing list pgsql-hackers

From Takahiro Itagaki
Subject Re: Type modifiers for DOMAIN
Date
Msg-id 20100107094323.97A1.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Re: Type modifiers for DOMAIN  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Because the domain is supposed to be opaque as to exactly what its
> underlying type is.  In particular, you're supposed to do this:
> 
>     CREATE DOMAIN varchar2 AS pg_catalog.varchar(10);
> 
> If you look in the SQL spec you will not find any suggestion that it
> should work the way you propose.

Hmmm, it means we need to create domains for each length of character types.
If we allowed domains with pass-through-modifiers, it could save codes
than CREATE (scalar) TYPE.
=# CREATE DOMAIN digit_varchar AS varchar ( <pass-through-modifiers> )     CHECK (VALUE ~ E'^\\d*$');=# CREATE TABLE
tbl(digit10 digit_varchar(10));
 

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: unresolved bugs
Next
From: Josh Berkus
Date:
Subject: Re: unresolved bugs