| From: | Janning Vygen <vygen(at)gmx(dot)de> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | How to use as Functional Index to be used as Primary KEY |
| Date: | 2004-07-31 13:48:06 |
| Message-ID: | 200407311548.06813.vygen@gmx.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi,
i searched the docs and the archives and was really wondering that i have not
found anything searching for "functional index primary key".
i would like to have a table of members with nicknames which are
case-insensitive but i would like to save the user given name case-sensitive
to display 'JimKnopf' instead of 'jimknopf':
CREATE TABLE members (
nickname text NOT NULL,
CONSTRAINT pk_test PRIMARY KEY (lower(name))
);
psql:scratch.sql:7: ERROR: syntax error at or near "(" at character 92
Of course i can use an index like this:
CREATE TABLE members (
nickname text NOT NULL,
);
CREATE UNIQUE INDEX ix_name ON test (lower(name));
but the key isn't marked as primary then.
So here is my question: How can i define a functional index to be used with a
primary key (using postgreSQL 7.4.3)?
can anybody help me with this problem or give me a link to a archived mail
about this topic?
kind regards,
janning
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2004-07-31 15:02:26 | Re: How to use as Functional Index to be used as Primary KEY |
| Previous Message | Geoff Caplan | 2004-07-31 09:09:07 | Correct escaping of untrusted data |