Skip site navigation (1) Skip section navigation (2)

Re: domains, types, constraints

From: Andrew Winkler <the_andrew_winkler(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: domains, types, constraints
Date: 2008-01-17 16:23:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Thanks for responding. Here's a simple example of the kind of thing I'm trying to do:

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

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(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Winkler <the_andrew_winkler(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Sent: Tuesday, January 15, 2008 8:55:34 PM
Subject: Re: [NOVICE] domains, types, constraints 

Andrew Winkler <the_andrew_winkler(at)yahoo(dot)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
TIP 6: explain analyze is your friend

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.


pgsql-novice by date

Next:From: Tom LaneDate: 2008-01-17 16:30:22
Subject: Re: domains, types, constraints
Previous:From: Greg CocksDate: 2008-01-16 17:38:29
Subject: Changing 'on update' actions on existing FK constraints

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group