BUG #5115: ADD UNIQUE table_constraint with expression - Mailing list pgsql-bugs

From Vladimir Kokovic
Subject BUG #5115: ADD UNIQUE table_constraint with expression
Date
Msg-id 200910141459.n9EExdVO032025@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5115: ADD UNIQUE table_constraint with expression
Re: BUG #5115: ADD UNIQUE table_constraint with expression
Re: BUG #5115: ADD UNIQUE table_constraint with expression
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5115
Logged by:          Vladimir Kokovic
Email address:      vladimir.kokovic@a-asoft.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@[local]:5432) 16:51:39 [asoft]
*#

pgsql-bugs by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: issue with integer nullable column and value 0
Next
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5115: ADD UNIQUE table_constraint with expression