From: Andrei Bintintan <klodoma@ar-sd.net>
To: pgsql-sql@postgresql.org
Subject: UNIQUE columnt depdening on other column???
Date: Wed, 2 Jun 2004 14:39:45 +0300
Message-ID: <20040602113937.D45E11765F@ar-sd.net> (raw)
Hi,
I have a problem.
Let's say I have the following table:
CREATE TABLE rekl_element(
id serial PRIMARY KEY,
active boolean NOT NULL DEFAULT 'y',
num int4 NOT NULL,
text varchar(10)
);
Now I want that "num" column is "unique" but only for those columns that
have active='y'. For the columns that have active='f' I don't care if num is
unique or not. I'm asking this because num will be doubled some times.
How can I write a constraint, trigger function... etc to check this?
Thanks in advance.
Andy.
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-sql@postgresql.org
Cc: klodoma@ar-sd.net
Subject: Re: UNIQUE columnt depdening on other column???
In-Reply-To: <20040602113937.D45E11765F@ar-sd.net>
* 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