From: Michael Monnerie <michael.monnerie@it-management.at>
To: pgsql-admin@postgresql.org
Subject: How to set a constraint on non-unique fields?
Date: Tue, 26 Jun 2007 17:11:06 +0200
Message-ID: <200706261711.06656@zmi.at> (raw)
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
Attachments:
signature.asc (application/pgp-signature, 188B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: michael.monnerie@it-management.at
Subject: Re: How to set a constraint on non-unique fields?
In-Reply-To: <200706261711.06656@zmi.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox