Re: Type modifiers for DOMAIN

From: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Type modifiers for DOMAIN
Date: 2010-01-07 00:43:23
Message-ID: 20100107094323.97A1.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2010-01-07 00:44:44 Re: unresolved bugs
Previous Message Robert Haas 2010-01-07 00:40:30 Re: unresolved bugs