BUG #5115: ADD UNIQUE table_constraint with expression

From: "Vladimir Kokovic" <vladimir(dot)kokovic(at)a-asoft(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5115: ADD UNIQUE table_constraint with expression
Date: 2009-10-14 14:59:39
Message-ID: 200910141459.n9EExdVO032025@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5115
Logged by: Vladimir Kokovic
Email address: vladimir(dot)kokovic(at)a-asoft(dot)com
PostgreSQL version: PostgreSQL 8.4.
Operating system: Linux vlD-kuci 2.6.28-15-generic #52-Ubuntu SMP Wed Sep
9 10:49:34 UTC 2009 i686 GNU/Linux
Description: ADD UNIQUE table_constraint with expression
Details:

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...
^
LOCATION: base_yyerror, scan.l:907

Create index is OK:
*# CREATE UNIQUE INDEX vk2 on
adefault_finansije.gk_promene((substring(broj,10)),id);
CREATE INDEX
(vlada(at)[local]:5432) 16:51:39 [asoft]
*#

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2009-10-14 15:15:00 Re: BUG #5115: ADD UNIQUE table_constraint with expression
Previous Message Kevin Grittner 2009-10-14 14:38:53 Re: issue with integer nullable column and value 0