Re: unique index with bool

From: Stuart Bishop <stuart(at)stuartbishop(dot)net>
To: tmpmac(at)mac(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: unique index with bool
Date: 2005-05-25 04:26:50
Message-ID: 4293FE8A.8050803@stuartbishop.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tmpmac(at)mac(dot)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(at)stuartbishop(dot)net>
http://www.stuartbishop.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2005-05-25 04:39:50 Re: getting lock information
Previous Message Tom Lane 2005-05-25 03:49:00 Re: PostgreSQL release schedule