Re: Thoughts on a cosntraint ?

Поиск
Список
Период
Сортировка
От Rob Sargent
Тема Re: Thoughts on a cosntraint ?
Дата
Msg-id F01FBE40-A1DD-49B7-9C73-7ECA4F987E76@gmail.com
обсуждение исходный текст
Ответ на Re: Thoughts on a cosntraint ?  (John W Higgins <wishdev@gmail.com>)
Список pgsql-general


On Sep 29, 2019, at 1:52 PM, John W Higgins <wishdev@gmail.com> wrote:

On Sun, Sep 29, 2019 at 12:40 PM stan <stanb@panix.com> wrote:
I have a table that consists of 3 columns.

vendor_key
mfg_key
preferred (boolean)

The idea is that a given vendor is the vendor we want to use for each
manufacturer for a given project.

I need to constrain such that  only on row of mfg, vendor and project can
be set to TRUE.


Partial unique index

Example 3 on this page https://www.postgresql.org/docs/current/indexes-partial.html is exactly what you are looking for.

John W Higgins

Yes but I have to wonder about one-and-only-one preferred vendor: if there are many known, acceptable vendors, wouldn’t a ranking be more useful?  On a crucial commodity it is common practice to continuously use more than one vendor (i.e. multiple preferred vendors).


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

Предыдущее
От: John W Higgins
Дата:
Сообщение: Re: Thoughts on a cosntraint ?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Thoughts on a cosntraint ?