From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Vladimir Kokovic" <vladimir(dot)kokovic(at)a-asoft(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #5115: ADD UNIQUE table_constraint with expression |
Date: | 2009-10-14 15:16:27 |
Message-ID: | 13665.1255533387@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"Vladimir Kokovic" <vladimir(dot)kokovic(at)a-asoft(dot)com> writes:
> For ALTER TABLE ADD CONSTRAINT documentation says:
> ADD table_constraint
> This form adds a new constraint to a table using the same syntax as
> CREATE TABLE.
> But if expression is used in the constraint definition
> server says:
> # ALTER TABLE asoft_finansije.gk_promene ADD CONSTRAINT vk2
> UNIQUE((substring(broj,10)),id)
> asoft-# ;
> ERROR: 42601: syntax error at or near "("
> LINE 1: ...ft_finansije.gk_promene ADD CONSTRAINT vk2 UNIQUE((substring...
> ^
Yeah, if you tried writing that in CREATE TABLE, it would complain too.
> Create index is OK:
> *# CREATE UNIQUE INDEX vk2 on
> adefault_finansije.gk_promene((substring(broj,10)),id);
> CREATE INDEX
This is not a CONSTRAINT clause in a CREATE TABLE.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2009-10-14 15:23:32 | Re: BUG #5115: ADD UNIQUE table_constraint with expression |
Previous Message | Kevin Grittner | 2009-10-14 15:15:00 | Re: BUG #5115: ADD UNIQUE table_constraint with expression |