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 1967ED1B52D for ; Sun, 28 Sep 2003 05:28:51 +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 75819-04 for ; Sun, 28 Sep 2003 02:28:41 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 5082ED1B508 for ; Sun, 28 Sep 2003 02:28:40 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3690709; Sat, 27 Sep 2003 22:29:12 -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:28:07 -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: <200309272228.07762.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/357 X-Sequence-Number: 15335 Richard, >--------------------------- CREATE OR REPLACE FUNCTION public.locate(bpchar, > bpchar) > RETURNS int4 AS > ' > -- search for the position of $2 in $1 > > declare > srcstr alias for $1; > searchstr alias for $2; > > begin > return position(searchstr in srcstr); You're missing "END;". > ' > LANGUAGE 'plpgsql' VOLATILE; Also, the function is not VOLATILE. It's IMMUTABLE, and STRICT as well. -- Josh Berkus Aglio Database Solutions San Francisco