UNIQUE constraints on function results

From: Markus Schiltknecht <markus(at)bluegap(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Subject: UNIQUE constraints on function results
Date: 2006-10-05 09:16:28
Message-ID: 4524CD6C.70101@bluegap.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I've been trying to add a unique constraint on a row and a function
result of a row. I.e.:

CREATE TABLE test (
id SERIAL PRIMARY KEY,
t1 TEXT NOT NULL,
t2 TEXT NOT NULL,
UNIQUE (t1, lower(t2)));

That fails with a syntax error (on 8.2beta1). While UNIQUE(t1, t2) works
like a charm, it's not exactly what I want.

I can easily create an index for my needs [1], why can I not add such a
unique constraint? Thanks for clarification.

Regards

Markus

[1]: CREATE INDEX test_idx ON test(t1, lower(t2));

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Bauer 2006-10-05 11:55:25 Re: Major Performance decrease after some hours
Previous Message Alexander Staubo 2006-10-05 08:55:09 Re: Major Performance decrease after some hours