Re: [GENERAL] Tr: UNIQUE

From: José Soares <jose(at)sferacarta(dot)com>
To: Stéphane FILLON <fillons(at)offratel(dot)nc>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Tr: UNIQUE
Date: 1999-08-06 16:09:46
Message-ID: 37AB08CA.61CF998@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Try this:

create table amount(
id int4 constraint pk_amount primary key,
fk_acount int4 not null,
code char(3) not null,
constraint unico unique (fk_acount, code)
);

José

Stéphane FILLON ha scritto:

> -----Message d'origine-----
> De : Stéphane FILLON <fillons(at)offratel(dot)nc>
> À : pgsql-sql(at)postgresql(dot)org <pgsql-sql(at)postgresql(dot)org>;
> pgsql-novice(at)postgresql(dot)org <pgsql-novice(at)postgresql(dot)org>
> Date : dimanche 1 août 1999 09:12
> Objet : Tr: UNIQUE
>
> >>Hi !
> >>
> >>I have a table with a primary key id to have a unique tuple and
> >>
> >>I want to check that (fk_acount + code) is unique.
> >>
> >>I don't know how to create this CHECK CONSTRAINT
> >>
> >>create table amount(
> >> id int4 constraint pk_amount primary key,
> >> fk_acount int4 not null,
> >> code char(3) not null
> >>);
> >>
> >>Thanks in advance.
> >>
> >>Stephane
> >>
> >>
> >

In response to

  • Tr: UNIQUE at 1999-08-04 17:51:17 from Stéphane FILLON

Browse pgsql-general by date

  From Date Subject
Next Message Dustin Sallings 1999-08-06 16:42:36 Re: [GENERAL] Database on read only directory
Previous Message Bruce Momjian 1999-08-06 14:57:16 Re: [GENERAL] What is R_PLANS?