Ottavio Campana wrote:
> Here's an example of what I'm doing: I have a table like
>
> create table (
> id serial,
> description text not null,
> active boolean default true);
>
> What I want to do is a function inserting a new item into the table
> ensuring that there is only one record in the table having a particular
> description and at the same time the active field set to true (it might
> seem stupid, but the application requires it).
Assuming active can't be NULL, what's wrong with a UNIQUE constraint on
(description, active)?
--
Alban Hertroys
alban@magproductions.nl
magproductions b.v.
T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede
// Integrate Your World //