Re: domains, types, constraints

From: Andrew Winkler <the_andrew_winkler(at)yahoo(dot)com>
To: Andrew Winkler <the_andrew_winkler(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: domains, types, constraints
Date: 2008-01-22 18:43:59
Message-ID: 874065.70950.qm@web52702.mail.re2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Can unique only reference columns? Am I not able to do what I'm trying to do here, or am I just being stupid
about how I'm trying to do it?

create type e_mail as (address text, domain text);
CREATE TYPE
create table e_mail_t ( e email, unique((e).address, (e).domain) );
ERROR: syntax error at or near "("
LINE 1: create table e_mail_t ( e email, unique((e).address, (e).dom...
^
create table e_mail_t ( e email, unique(e));
ERROR: data type email has no default operator class for access method "btree"
HINT: You must specify an operator class for the index or define a default operator class for the data type.
ERROR: syntax error at or near ")"
LINE 1: )

____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2008-01-22 19:06:33 Re: domains, types, constraints
Previous Message Andrew Winkler 2008-01-22 18:31:58 Re: Reason(s) not to use a stored procedure