pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedunique index on more than one field using functions
2+ messages / 2 participants
[nested] [flat]
* unique index on more than one field using functions
@ 2001-07-22 10:14 Domingo Alvarez Duarte <domingo@dad-it.com>
0 siblings, 1 reply; 2+ messages in thread
From: domingo@dad-it.com @ 2001-07-22 10:14 UTC (permalink / raw)
To: pgsql-sql
I'm trying create a unique index using more than one field and
applying a function in one field to achieve case insensitive
uniqueness but postgresql doesn't accept.
create table a(
id int primary key,
id2 int not null,
name varchar(50),
unique(id2, lower(name))
);
Anyone have an idea ?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: unique index on more than one field using functions
@ 2001-07-23 17:49 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: Domingo Alvarez Duarte <domingo@dad-it.com>
0 siblings, 0 replies; 2+ messages in thread
From: Stephan Szabo @ 2001-07-23 17:49 UTC (permalink / raw)
To: Domingo Alvarez Duarte <domingo@dad-it.com>; +Cc: pgsql-sql
On 22 Jul 2001, Domingo Alvarez Duarte wrote:
> I'm trying create a unique index using more than one field and
> applying a function in one field to achieve case insensitive
> uniqueness but postgresql doesn't accept.
>
> create table a(
>
> id int primary key,
> id2 int not null,
> name varchar(50),
> unique(id2, lower(name))
> );
>
> Anyone have an idea ?
IIRC, Functional indexes are constrained to a single function
with one or more column references (no constants, etc), so
you can't precisely do the above directly. You might be
able to make a function which takes id2 and name and combines
them in some way returning a single varchar and make the unique
index on that result.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-07-23 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-22 10:14 unique index on more than one field using functions Domingo Alvarez Duarte <domingo@dad-it.com>
2001-07-23 17:49 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox