Re: unique index with bool - Mailing list pgsql-general

From Stuart Bishop
Subject Re: unique index with bool
Date
Msg-id 4293FE8A.8050803@stuartbishop.net
Whole thread Raw
In response to unique index with bool  (tmpmac@mac.com)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tmpmac@mac.com wrote:
> CREATE UNIQUE INDEX name on table(param1,param2);
>
> How to create such unique index when param2 is bool type, and this param2 should be accepted only in case of true ?
>
> I tried: CREATE UNIQUE INDEX name on table(param1,(param2 = 'true'));
> but it's not working.

CREATE UNIQUE INDEX foo ON table(param1, (NULLIF(param2, false)))



- --
Stuart Bishop <stuart@stuartbishop.net>
http://www.stuartbishop.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCk/6KAfqZj7rGN0oRAvZ+AJwLWDd8FQe5nBjFDv7ariZ8o8rwLgCfRTdy
BP2yMApbjMDdpDqetUQnX3A=
=k5zA
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: PostgreSQL release schedule
Next
From: Neil Conway
Date:
Subject: Re: getting lock information