From: | Reece Hart <reece(at)in-machina(dot)com> |
---|---|
To: | Jodi Kanter <jkanter(at)virginia(dot)edu> |
Cc: | Postgres Admin List <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: no dup rows |
Date: | 2004-08-02 19:09:52 |
Message-ID: | 1091473791.16547.89.camel@tallac |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Mon, 2004-08-02 at 11:32, Jodi Kanter wrote:
> I have a linking table that has only two fields in it and both are
> foreign keys to other tables. I'd like to ensure that there are never
> any duplicate rows in this table. I was planning on creating a
> multi-column unique index to satisfy this requirement. Is there a more
> appropriate way to accomplish this or am I on the right track?>
Yep, that is the correct way to impose this constraint.
I give constraints meaningful names prefixed by the table name (e.g.,
tablename_seq_already_in_set) so that the cause of an error is more
readily identifiable. This is particularly useful for insertions into
complex tables with multiple constraints.
-Reece
--
Reece Hart, Ph.D. rkh(at)gene(dot)com, http://www.gene.com/
Genentech, Inc. 650-225-6133 (voice), -5389 (fax)
Bioinformatics and Protein Engineering
1 DNA Way, MS-93 http://www.in-machina.com/~reece/
S. San Francisco, CA 94080-4990 reece(at)in-machina(dot)com, GPG: 0x25EC91A0
From | Date | Subject | |
---|---|---|---|
Next Message | LISTMAN | 2004-08-03 09:48:59 | Re: [HACKERS] Where does the xlateSqlType symbol point |
Previous Message | Bill Harper | 2004-08-02 19:05:42 | Re: no dup rows |