From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: shyamperi@davlin.co.in
Cc: pgsql-admin@postgresql.org
Subject: Re: error with functions
Date: Mon, 22 Sep 2003 08:43:38 -0700 (PDT)
Message-ID: <20030922083927.M2590@megazone.bigpanda.com> (raw)
In-Reply-To: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in>
References: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in>
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"
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: sszabo@megazone.bigpanda.com, shyamperi@davlin.co.in
Subject: Re: error with functions
In-Reply-To: <20030922083927.M2590@megazone.bigpanda.com>
References: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in> <20030922083927.M2590@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox