Re: Functional index adding one

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: <lbarcala(at)freeresearch(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Functional index adding one
Date: 2008-07-03 13:37:18
Message-ID: 8763rnay29.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<lbarcala(at)freeresearch(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Long Cui 2008-07-03 13:40:42 simple installation problem in windows system
Previous Message Lennin Caro 2008-07-03 13:35:34 Re: pg_ctl start check sum failed