Re: UNIQUE boolean: only one row may be "true"
От | Ries van Twisk |
---|---|
Тема | Re: UNIQUE boolean: only one row may be "true" |
Дата | |
Msg-id | 002001c3146b$22a17a50$f100000a@IT001 обсуждение исходный текст |
Ответ на | Re: UNIQUE boolean: only one row may be "true" (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-sql |
Tom, > FWIW, I'd go with the unique partial index too. It's a very efficient > solution. But it's not portable :-(. I'd be interested to hear what > people would do to solve this problem in bog-standard SQL. I do it by creating a trigger (on a INSERT or UPDDATE trigger) which call's a pgsql function. Not very eficcient but I don't have that many inserts for the tables on a regular base (100 a day at the max...) Ries > -----Oorspronkelijk bericht----- > Van: pgsql-sql-owner@postgresql.org > [mailto:pgsql-sql-owner@postgresql.org]Namens Tom Lane > Verzonden: woensdag 7 mei 2003 5:01 > Aan: Randall Lucas > CC: Michael Teter; pgsql-sql@postgresql.org > Onderwerp: Re: [SQL] UNIQUE boolean: only one row may be "true" > > > Randall Lucas <rlucas@tercent.net> writes: > > Do you have any suggestions on how this might > > better be implemented? It seems to me that with a partial > index, there > > is not too much overhead and it doesn't seem too offensively > > un-boycecoddean. > > FWIW, I'd go with the unique partial index too. It's a very efficient > solution. But it's not portable :-(. I'd be interested to hear what > people would do to solve this problem in bog-standard SQL. > > regards, tom lane > > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) >
В списке pgsql-sql по дате отправления: