Re: Type modifiers for DOMAIN

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org
Date: 2010-01-06T16:54:36Z
Lists: pgsql-hackers
Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp> writes:
> Domains were created successfully, but I cannot use type modifiers for them.
>     =# CREATE TABLE tbl (v varchar2(10));
>     ERROR:  type modifier is not allowed for type "varchar2"

> What reason do we have not to inherit typmodin/typmodout from the base type?

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.

			regards, tom lane