Re: domains, types, constraints - Mailing list pgsql-novice

From Andrew Winkler
Subject Re: domains, types, constraints
Date
Msg-id 639775.5376.qm@web52705.mail.re2.yahoo.com
Whole thread Raw
In response to domains, types, constraints  (Andrew Winkler <the_andrew_winkler@yahoo.com>)
Responses Re: domains, types, constraints  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Thanks for responding. Here's a simple example of the kind of thing I'm trying to do:

postgres=# drop type complex;
DROP TYPE
postgres=# create type complex as (r numeric, i numeric);
CREATE TYPE
postgres=# create domain unitary as complex;
ERROR:  "complex" is not a valid base type for a domain
postgres=#

The idea in this example would be to create a domain of complex numbers where
r*r + i*i is not zero.

Are composite types not useable for domains?

----- Original Message ----
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Winkler <the_andrew_winkler@yahoo.com>
Cc: pgsql-novice@postgresql.org
Sent: Tuesday, January 15, 2008 8:55:34 PM
Subject: Re: [NOVICE] domains, types, constraints


Andrew Winkler <the_andrew_winkler@yahoo.com> writes:
> I'm having trouble with types and domains. I can create a type, but
 then when I try to create constraints
> using the components of the type, I get syntax errors. I've read
 through the pdf several times, to no avail.
> Things like (value).component, component(value), value::component,
 for example, all generate errors.

This is nearly content-free :-(.  Show us exactly what commands you
tried and what errors you got.  (Cut and paste from a terminal window
is good.)

            regards, tom lane

---------------------------(end of
 broadcast)---------------------------
TIP 6: explain analyze is your friend





      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

pgsql-novice by date:

Previous
From: "Greg Cocks"
Date:
Subject: Changing 'on update' actions on existing FK constraints
Next
From: Tom Lane
Date:
Subject: Re: domains, types, constraints