pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Ray <ray_siu@ge-ts.com.hk>
Cc: pgsql-performance@postgresql.org
Subject: Re: create index with substr function
Date: Wed, 20 Oct 2004 19:57:54 -0700 (PDT)
Message-ID: <20041020195604.T32588@megazone.bigpanda.com> (raw)
In-Reply-To: <069201c4b715$34851670$0f6010ac@raysiu>
References: <069201c4b715$34851670$0f6010ac@raysiu>


On Thu, 21 Oct 2004, Ray wrote:

> Hi All,
>
> I have a table in my postgres:
> Table: doc
>      Column     |            Type             | Modifiers
>      ---------------+-----------------------------+-----------
>  doc_id          | bigint                      | not null
>  comp_grp_id | bigint                      | not null
>  doc_type      | character varying(10)| not null
>  doc_urn        | character varying(20)| not null
>
> I want to create an index on doc_urn column with using substr function like this:
> CREATE INDEX idx_doc_substr_doc_urn ON doc USING btree (SUBSTR(doc_urn,10));
>
> but there is an error:
>
> ERROR:  parser: parse error at or near "10" at character 68
>
> what's wrong for this SQL? As I have found some reference on the
> internet, I can't find anything wrong in this SQL.

What version are you using? If you're using anything previous to 7.4 then
the above definately won't work and the only work around I know of is to
make another function which takes only the column argument and calls
substr with the 10 constant.




view thread (8+ messages)  latest in thread

Message-ID: <20041020195604.T32588@megazone.bigpanda.com>
Permalink:  ../20041020195604.T32588@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20041020195604.T32588@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, ray_siu@ge-ts.com.hk
  Subject: Re: create index with substr function
  In-Reply-To: <20041020195604.T32588@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox