Re: Unique Index - Mailing list pgsql-general

From Greg Stark
Subject Re: Unique Index
Date
Msg-id 87hdlcc72l.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Unique Index  ("Frank D. Engel, Jr." <fde101@fjrhome.net>)
List pgsql-general
"Frank D. Engel, Jr." <fde101@fjrhome.net> writes:

> I'm sure this won't work for some reason, but something similar might; why not
> create a unique index on a constant where all three are null; something along
> these lines (in addition to the others):
>
> CREATE UNIQUE INDEX foo_trio_index ON foo (1) WHERE c IS NULL AND a IS NULL and
> b IS NULL;
>

Huh. Hadn't thought of creating an index on a constant. It works if you put an
extra set of parentheses in:

CREATE UNIQUE INDEX foo_abc_index ON foo ((1)) WHERE ...


--
greg

pgsql-general by date:

Previous
From: Jackson Pauls
Date:
Subject: Re: connecting with a 8.0.0 client with ssl
Next
From: troyston campano
Date:
Subject: Postgresql Security Pen Test