Re: [GENERAL] UNIQUE constraints on function results

2006-10-05 Thread Tom Lane
Markus Schiltknecht <[EMAIL PROTECTED]> writes: > UNIQUE (t1, lower(t2))); > I can easily create an index for my needs [1], why can I not add such a > unique constraint? Thanks for clarification. Because the SQL spec defines this syntax, and it only allows column names there. Extending th

Re: [GENERAL] UNIQUE constraints on function results

2006-10-05 Thread Markus Schiltknecht
Emanuele Rocca wrote: you'll get a duplicate key error. Thank you, that solves my problem. Although it makes me wonder even more why I'm not allowed to define such a constraint. Looks like all the necessary backend code is there. Regards Markus ---(end of broadcast

Re: [GENERAL] UNIQUE constraints on function results

2006-10-05 Thread Emanuele Rocca
Hello Markus, * Markus Schiltknecht <[EMAIL PROTECTED]>, [2006-10-05 11:16 +0200]: > 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, >

[GENERAL] UNIQUE constraints on function results

2006-10-05 Thread Markus Schiltknecht
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,