From: | Michael Monnerie <michael(dot)monnerie(at)it-management(dot)at> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | How to set a constraint on non-unique fields? |
Date: | 2007-06-26 15:11:06 |
Message-ID: | 200706261711.06656@zmi.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi list, I hope this is not OT here, but I'm no SQL guru and sure some
know this. I have two tables:
(just in short format)
multilang (id int, language int, text text);
types (id int, textid references multilang(id) on delete restrict);
But that doesn't work out, because "id" in multilang is not unique. For
one "id", there can be several "language" values, having a text in that
language. Now in table types, I want to make sure that "textid" MUST
exist in multilang, and cannot be deleted when having references. How
would I do that?
mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0676/846 914 666 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: EA39 8918 EDFF 0A68 ACFB 11B7 BA2D 060F 1C6F E6B0
// Keyserver: www.keyserver.net Key-ID: 1C6FE6B0
From | Date | Subject | |
---|---|---|---|
Next Message | cha | 2007-06-26 17:04:41 | importing limited set of rows/tuples |
Previous Message | George Wilk | 2007-06-26 11:47:24 | warm standby server configuration |