X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 44D0432B1EA for ; Thu, 21 Oct 2004 06:12:21 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61057-03 for ; Thu, 21 Oct 2004 05:12:15 +0000 (GMT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by svr1.postgresql.org (Postfix) with ESMTP id 3769E32B1FB for ; Thu, 21 Oct 2004 06:11:41 +0100 (BST) Received: from mail.ge-ts.com.hk (unknown [202.66.115.131]) by svr4.postgresql.org (Postfix) with ESMTP id 9E8135AF5FC for ; Thu, 21 Oct 2004 03:13:08 +0000 (GMT) Received: from raysiu ([172.16.96.15]) by mail.ge-ts.com.hk (8.12.8/8.12.8) with SMTP id i9L3B5Ch013400 for ; Thu, 21 Oct 2004 11:11:05 +0800 Message-ID: <06e201c4b71b$9ae9cc70$0f6010ac@raysiu> From: "Ray" To: References: <069201c4b715$34851670$0f6010ac@raysiu> <20041020195604.T32588@megazone.bigpanda.com> Subject: Re: create index with substr function Date: Thu, 21 Oct 2004 11:11:05 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/336 X-Sequence-Number: 8812 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" To: "Ray" Cc: 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. >