X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DC254D1C9F0 for ; Mon, 22 Sep 2003 15:43:54 +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 49082-07 for ; Mon, 22 Sep 2003 12:43:44 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 33874D1B57E for ; Mon, 22 Sep 2003 12:43:44 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 66A033522D; Mon, 22 Sep 2003 08:43:38 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 6539A35197; Mon, 22 Sep 2003 08:43:38 -0700 (PDT) Date: Mon, 22 Sep 2003 08:43:38 -0700 (PDT) From: Stephan Szabo To: shyamperi@davlin.co.in Cc: pgsql-admin@postgresql.org Subject: Re: error with functions In-Reply-To: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in> Message-ID: <20030922083927.M2590@megazone.bigpanda.com> References: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/345 X-Sequence-Number: 10433 On Mon, 22 Sep 2003 shyamperi@davlin.co.in wrote: > >You do realize that the shell is going to interpret that string in > >double quotes right? > I guess so, for the very same I have tried with > Command: psql test -c "> CREATE FUNCTION add_one (integer) RETURNS > INTEGER AS ' BEGIN RETURN ''$1'' + 1; END; ' LANGUAGE > 'plpgsql';" > But still it is not taking it as $1, instead empty string. > Ideeally it shud consider $1 as string... but why isn't it The shell interprets the double quoted string and effectively replaces $1 with the shell's idea of what to put in place of it. This really has nothing to do with postgres at all. Use a backslash before the $1, or put it in a file and execute it from there. Try these for example: echo "$1" echo '$1' echo "\$1"