Re: unique index with bool

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: tmpmac(at)mac(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: unique index with bool
Date: 2005-05-19 15:34:44
Message-ID: 1116516884.31821.78.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2005-05-19 at 09:49, 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.

Not sure if this is what you want:

create unique index on table(param1, param2) where param2 is true;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-05-19 15:42:13 Re: Shared memory and FreeBSD's jail()
Previous Message Scott Marlowe 2005-05-19 15:33:42 Re: Shared memory and FreeBSD's jail()