Skip site navigation (1) Skip section navigation (2)

Re: How to successfully create a new function?

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to successfully create a new function?
Date: 2012-04-03 17:06:06
Message-ID: 20120403170606.GA11098@tux (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-novice
Jim Moon <moonjamesg(at)gmail(dot)com> wrote:

> plpgsql is installed.  Thank you all for the pointers.
> 
> This query:
> 
> CREATE OR REPLACE FUNCTION "sp_SetScenario"(scen character varying) RETURNS
> void AS
> $BODY$DECLARE
>     sqlStatement VARCHAR(500);
> BEGIN
>     SET sqlStatement = 'ALTER USER postgres WITH DEFAULT_SCHEMA = ' + $1;
>     EXEC(sqlStatement);

String-Concatination? Don't use +, use || instead.



Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

In response to

pgsql-novice by date

Next:From: Jim MoonDate: 2012-04-03 17:22:09
Subject: Re: How to successfully create a new function?
Previous:From: Jim MoonDate: 2012-04-03 14:53:13
Subject: How to connect to remote instance?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group