Constraint Problem

Поиск
Список
Период
Сортировка
От Ron St-Pierre
Тема Constraint Problem
Дата
Msg-id 3DC40D2D.3070409@syscor.com
обсуждение исходный текст
Ответы Re: Constraint Problem  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I want to create a constraint that's a little different, but don't know
how to implement it. I have an intermediate table with a compound PK and
a boolean 'ysnDefault' column:

   comanyID     INTEGER REFERENCES companies,
   assocationID INTEGER REFERENCES associations,
   ysnDefault     BOOLEAN

I just want to constrain the ysnDefault field to only allow one TRUE
value for any companyID/associationID pair, with no restrictions on the
number of FALSES.

At first glance I thought it would be easy, but I can't see how to do
it. Any suggestions?

Thanks
Ron



В списке pgsql-general по дате отправления:

Предыдущее
От: Will Trillich
Дата:
Сообщение: Re: Perl and Postgres
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Constraint Problem