Re: exclusion constraint for ranges of IP

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: exclusion constraint for ranges of IP
Дата
Msg-id j2vvie$u2i$2@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на exclusion constraint for ranges of IP  (Herouth Maoz <herouth@unicell.co.il>)
Ответы Re: exclusion constraint for ranges of IP  (Herouth Maoz <herouth@unicell.co.il>)
Список pgsql-sql
On 2011-08-23, Herouth Maoz <herouth@unicell.co.il> wrote:

>     EXCLUDE USING GIST  ( customer_id WITH =, is_default WITH AND )


> Basically, each customer can have several rows in this table, but only =
> one per customer is allowed to have is_default =3D true. Is this exclude =
> constraint correct?

I don't really understand exclude, but instead of EXCLUDE... I would do

CREATE UNIQUE INDEX "invoice_definitions-unique-default"  ON invoice_definitions(customer_id) WHERE is_default;

Which would create a smaller (and probably faster) BTREE index 
containing only the rows with is_default true.

There seems to be no way to create this in the create-table 
command. (using 8.4 here)


-- 
⚂⚃ 100% natural



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

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: Confused about writing this stored procedure/method.
Следующее
От: Herouth Maoz
Дата:
Сообщение: Re: exclusion constraint for ranges of IP