From: | Jochem van Dieten <jochemd(at)oli(dot)tudelft(dot)nl> |
---|---|
To: | Francisco J Reyes <fran(at)natserv(dot)net> |
Cc: | pgsql General List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Domains (Was [PERFORM] Views With Unions) |
Date: | 2003-08-02 16:29:19 |
Message-ID: | 3F2BE6DF.2060706@oli.tudelft.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Francisco J Reyes wrote:
> Are domains user defined types? That they seem to be based on what I see
> on the docs.
They are similar a bit to user defined types, but there are some
important differences.
First of all, domains are based on other datatypes, so you would
have to have an existing datatype that is a sufficiently close match.
Secondly, domains can be mixed directly with the datatype they
are based on and other domains that are based on that datatype.
User defined types require you to first cast them (which in turn
implies a casting function needs to be defined) to the other/a
common type before you can mix them.
Overall, I tend to see them more as macro's then as real
datatypes. Typically I use them to verify that data is properly
formatted (like the phone number example).
Please note that the SQL:1999 concept of user defined types is
quite different from the one in PostgreSQL (in his book "Advanced
SQL:1999" Jim Melton even warns that domains may be deprecated in
future SQL standards in favour of SQL-style user defined types).
Jochem
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2003-08-02 17:13:40 | Re: pl/R questions |
Previous Message | Tom Lane | 2003-08-02 14:50:31 | Re: plPHP -- sort of an announcement.. but not commercial |