Re: BUG #8211: Syntax error when creating index on expression - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #8211: Syntax error when creating index on expression
Date
Msg-id 25396.1370450106@sss.pgh.pa.us
Whole thread Raw
In response to BUG #8211: Syntax error when creating index on expression  (acizov@gmail.com)
List pgsql-bugs
acizov@gmail.com writes:
> CREATE INDEX heuristic ON foos (1 / (a + b))
> causes:
> ERROR:  syntax error at or near "1"

This is not a bug.  You need an extra pair of parentheses around
the expression, ie

CREATE INDEX heuristic ON foos ((1 / (a + b)))

http://www.postgresql.org/docs/9.2/static/sql-createindex.html
points this out both in the syntax diagram and the text.

            regards, tom lane

pgsql-bugs by date:

Previous
From: bricklen
Date:
Subject: Re: BUG #8211: Syntax error when creating index on expression
Next
From: geoff.montee@gmail.com
Date:
Subject: BUG #8212: Feature request: View original value of current_user in function with SECURITY DEFINER set