From: | Keary Suska <hierophant(at)pcisys(dot)net> |
---|---|
To: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: brain-teaser with CONSTRAINT - any SQL experts? |
Date: | 2005-10-09 17:54:18 |
Message-ID: | BF6EB56A.22218%hierophant@pcisys.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
on 10/8/05 11:36 PM, mileskeaton(at)gmail(dot)com purportedly said:
> I know it's tempting to say, "just link a separate table for the book
> and don't store the book name" but let's just pretend that's not an
> option - because I'm not actually dealing with books : I just made up
> this simplified version of something at work, where we can't change
> the table : both isbn and name MUST be in the table, and what I'm
> trying to do is put a CONSTRAINT on the table definition to protect
> against user error, by making sure that any entered isbn is only tied
> to one book-name in that table.
I would create a multi-column unique index on the table. This should solve
the problem mentioned although you may still have an integrity issue if a
"book" name is mistyped.
Best regards,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
From | Date | Subject | |
---|---|---|---|
Next Message | CSN | 2005-10-09 19:46:51 | Duplicate primary keys/rows |
Previous Message | David Fetter | 2005-10-09 17:01:15 | Re: INSERT OR UPDATE? |