X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 827A5D1B511 for ; Sun, 28 Sep 2003 05:30:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 67440-08 for ; Sun, 28 Sep 2003 02:30:25 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id CEA20D1B4F5 for ; Sun, 28 Sep 2003 02:30:22 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3690710; Sat, 27 Sep 2003 22:30:55 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Richard Sydney-Smith" , Subject: Re: Mystery function error Date: Sat, 27 Sep 2003 22:29:50 -0700 User-Agent: KMail/1.4.3 References: <000c01c38572$73c03c50$251a32d2@athlon2000> In-Reply-To: <000c01c38572$73c03c50$251a32d2@athlon2000> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200309272229.50601.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/358 X-Sequence-Number: 15336 Richard, > The goal is to have > > locate( stra, strb) = position(strb in stra) Also, this will run faster if you do it as a SQL function: CREATE FUNCTION locate ( text, text ) RETURNS INT AS ' SELECT POSITION($2, $1); ' LANGUAGE SQL IMMUTABLE STRICT; -- Josh Berkus Aglio Database Solutions San Francisco