Re: Constraint Problem

Поиск
Список
Период
Сортировка
От Ron St-Pierre
Тема Re: Constraint Problem
Дата
Msg-id 3FA7D631.6060002@syscor.com
обсуждение исходный текст
Ответ на Re: Constraint Problem  (Greg Stark <gsstark@mit.edu>)
Ответы Re: Constraint Problem  (Csaba Nagy <nagy@ecircle-ag.com>)
Re: Constraint Problem  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: Constraint Problem  (Greg Stark <gsstark@mit.edu>)
Список pgsql-general
Greg Stark wrote:

>Ron St-Pierre <rstpierre@syscor.com> writes:
>
>
>
>>This is not quite what I need. I need to create a constraint to allow only
>>-one- of
>>    company<->association<->default(=true) value
>>but any number of
>>    company<->association<->default(=false) values
>>
>>
>
>So a unique index on "(company,association) where default" doesn't do what you
>want?
>
>
>
>
>
No it doesn't. For example, after I create the unique index I can still
input:
    company10     association7     true
    company10     association7     true
    company10     association7     true
I want to prevent this from happening, but still allow multiple
    company10     association7     false
    company10     association7     false
entries for example.

The idea of using NULLs is a good idea, but this is a production
database and would require changes to the web-based front end (7 of
them), not to mention each database. That's why I want to change the
behaviour to only allow one unique company<-->association<-->TRUE
combination. Right now there are a number of companies which have
multiple default associations in the database, so I am going to have to
back-trace and find out which association is actally the correct default.

BTW I am using postgresql 7.3.4

Ron


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

Предыдущее
От: Rob Fielding
Дата:
Сообщение: Re: pg7.3.4: pg_atoi: zero-length string
Следующее
От: Network Administrator
Дата:
Сообщение: Re: PostgreSQL v7.4 Release Candidate 1