Re: Unique constraint or index, case insensitive, on multiple fields

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: MargaretGillon(at)chromalloy(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Unique constraint or index, case insensitive, on multiple fields
Date: 2006-04-06 18:33:57
Message-ID: 26214.1144348437@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

MargaretGillon(at)chromalloy(dot)com writes:
> CREATE UNIQUE INDEX resource_refullname
> ON resource USING btree (redtid, (upper(refullname) text_ops));

You need something newer than PG 7.3 to do that. 7.3 can't handle
functional indexes with more than one column. There are many other good
reasons to upgrade anyway.

BTW the correct syntax would be

CREATE UNIQUE INDEX resource_refullname
ON resource USING btree (redtid, (upper(refullname)) text_ops);

If you're going to put an opclass name, it goes outside the parens.
(The only reason the parens are required at all is to separate the
expression from the opclass name ...)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moseley 2006-04-06 18:36:09 plgpsql and transactions
Previous Message Eric E 2006-04-06 18:26:34 Re: "Upcalls" (sort of) from the database