Re: Functional index adding one - Mailing list pgsql-general

From Gregory Stark
Subject Re: Functional index adding one
Date
Msg-id 8763rnay29.fsf@oxford.xeocode.com
Whole thread Raw
In response to Functional index adding one  (lbarcala@freeresearch.org)
Responses Re: Functional index adding one
List pgsql-general
<lbarcala@freeresearch.org> writes:

> Hi all:
>
> I'm trying to create a functional index into column position of token
> table (see below). I want to make something like:
>
> CREATE INDEX token_position_func
> ON token (position+1);
>
> but I get:
>
> test=# CREATE INDEX token_position_func
> test-# ON token (position+1);
> ERROR:  syntax error at or near "+"
> LINE 2: ON token (position+1);
>

I think you just need another set of parentheses:

CREATE INDEX token_position_func on (token(position+1))

Unless you're on a very old version of Postgres, I think 7.3 which had
functional indexes but not expression indexes.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's On-Demand Production Tuning

pgsql-general by date:

Previous
From: Lennin Caro
Date:
Subject: Re: pg_ctl start check sum failed
Next
From: "Long Cui"
Date:
Subject: simple installation problem in windows system