Re: create function : change name of input parameter

From: Lori Corbani <Lori(dot)Corbani(at)jax(dot)org>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: create function : change name of input parameter
Date: 2014-08-20 15:42:48
Message-ID: 4542636FF9185340AC1FDDE71BF1992B62BFE2B8@jaxbhexms02.jax.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


OK...if I manually run this within psql it is fine.

But I have a shell script in which I am wrapping a call to 'psql'...and I guess it does not like how things are being passed in when I do it this way.

So, yes, it is working correctly when I copy/paste my script directly into psql.

Will try a different approach to my wrapper.

Many thanks!
Lori

-----Original Message-----
From: Adrian Klaver [mailto:adrian(dot)klaver(at)aklaver(dot)com]
Sent: Wednesday, August 20, 2014 10:11 AM
To: Lori Corbani; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] create function : change name of input parameter

On 08/20/2014 07:00 AM, Lori Corbani wrote:
>
> My example:
>
> DROP FUNCTION ACC_setMax();
>
> CREATE OR REPLACE FUNCTION ACC_setMax ( increment int, prefixPart
> varchar(30) = 'MGI:'
> )
> RETURNS VOID AS
> \$\$
>
>
> BEGIN
>
> /* Increment the max MGI Accession Number by @increment */ update
> ACC_AccessionMax set maxNumericPart = maxNumericPart + increment where
> prefixPart = prefixPart ;
>
>
> END;
> \$\$
> LANGUAGE plpgsql;
>
> GRANT EXECUTE ON FUNCTION ACC_setMax(int,varchar) TO public;
>
> *****
>
> When I change the parameter "prefixPart" to "v_prefixPart"....I get the error.
>
> prefixPart varchar(30) = 'MGI:'
>
> where prefixPart = prefixPart
>
> changed to
>
> v_ prefixPart varchar(30) = 'MGI:'
>
> where prefixPart = v_prefixPart
>

Can we see the actual sequence in psql with the command outputs?

Also what is escaping the $?

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lori Corbani 2014-08-20 15:48:18 Re: create function : change name of input parameter
Previous Message Ramesh T 2014-08-20 15:41:19 POWA tool