Re: questions about query design
От | Alban Hertroys |
---|---|
Тема | Re: questions about query design |
Дата | |
Msg-id | 460246A9.8010909@magproductions.nl обсуждение исходный текст |
Ответ на | questions about query design (Ottavio Campana <ottavio@campana.vi.it>) |
Ответы |
Re: questions about query design
|
Список | pgsql-general |
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 //
В списке pgsql-general по дате отправления: