Skip site navigation (1) Skip section navigation (2)

Re: create index with substr function

From: "Ray" <ray_siu(at)ge-ts(dot)com(dot)hk>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: create index with substr function
Date: 2004-10-21 03:11:05
Message-ID: 06e201c4b71b$9ae9cc70$0f6010ac@raysiu (view raw or flat)
Thread:
Lists: pgsql-performance
Thank you all kindly response..... : )

I am currently using postgres 7.3, so any example or solution for version
after 7.4 if i want to create an index with substr function???

Thanks,
Ray


----- Original Message ----- 
From: "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>
To: "Ray" <ray_siu(at)ge-ts(dot)com(dot)hk>
Cc: <pgsql-performance(at)postgresql(dot)org>
Sent: Thursday, October 21, 2004 10:57 AM
Subject: Re: [PERFORM] create index with substr function


>
> 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.
>


In response to

pgsql-performance by date

Next:From: Rosser SchwarzDate: 2004-10-21 03:34:55
Subject: Re: create index with substr function
Previous:From: Tom LaneDate: 2004-10-21 02:59:14
Subject: Re: create index with substr function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group