Re: BUG #8211: Syntax error when creating index on expression

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: acizov(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8211: Syntax error when creating index on expression
Date: 2013-06-05 16:35:06
Message-ID: 25396.1370450106@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

acizov(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Johnston 2013-06-05 17:26:54 Re: BUG #8211: Syntax error when creating index on expression
Previous Message bricklen 2013-06-05 16:33:54 Re: BUG #8211: Syntax error when creating index on expression