Re: Is CREATE TYPE an alias for CREATE DOMAIN?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: Richard Huxton <dev(at)archonet(dot)com>, John Dean <john(at)totalrekall(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: Re: Is CREATE TYPE an alias for CREATE DOMAIN?
Date: 2005-12-22 16:13:30
Message-ID: 200512221613.jBMGDUx09493@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jim C. Nasby wrote:
> On Thu, Dec 22, 2005 at 09:36:52AM +0000, Richard Huxton wrote:
> > John Dean wrote:
> > >Hi
> > >
> > >Could somebody please tell me if CREATE TYPE is equivalent to CREATE
> > >DOMAIN? If not is there a work around
> >
> > What do you mean by "equivalent"? You wouldn't use them in the same way,
> > and I'm not sure what a work-around would consist of.
> >
> > What are you trying to do?
>
> Some (most?) database's idea of 'creating a type' is actually what we
> consider creating a domain, since many databases don't support users
> adding arbitrary types to the system. I suspect this user is trying to
> port some code over...

CREATE DOMAIN builds on an existing data type and adds additional
characteristics and checks to the type. It is sort of like a macro for
types.

CREATE TYPE creates a new data type, independent of existing data types,
and usually requires C code and a shared object file to load into the
database.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-12-22 16:14:37 Re: About Maximum number of columns
Previous Message Jim C. Nasby 2005-12-22 16:11:48 Re: Toolkit for creating editable grid