Re: How to successfully create a new function? - Mailing list pgsql-novice

From Jim Moon
Subject Re: How to successfully create a new function?
Date
Msg-id CAMW+QwHZHYJwbpyC_TOarVLrptr79Udjzz5Ju=kg9hyoe4KLPQ@mail.gmail.com
Whole thread Raw
In response to How to successfully create a new function?  (Jim Moon <moonjamesg@gmail.com>)
List pgsql-novice
Thank you all again.  This works:

CREATE OR REPLACE FUNCTION "sp_SetScenario"(scen character varying) RETURNS void AS $$
DECLARE sqlStatement varchar(500);
BEGIN
    sqlStatement = 'ALTER USER postgres WITH DEFAULT_SCHEMA = ' || scen;
    EXECUTE(sqlStatement);
END;
$$
LANGUAGE 'plpgsql'


I removed SET from:
      SET sqlStatement = 'ALTER USER postgres ...

I changed:
     EXEC(sqlStatement);
to:
     EXECUTE(sqlStatement);


Jim

pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: How to successfully create a new function?
Next
From: Andrej
Date:
Subject: Re: How to connect to remote instance?