Re: [GENERAL] PL/SQL & unset custom variable

2009-09-02 Thread Gordon Ross
ber 2009 19:16 To: Gordon Ross Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] PL/SQL & unset custom variable Gordon Ross writes: > Sorry, no joy :-( > grails=> SELECT current_setting('phone.id'); > ERROR: unrecognized configuration parameter "phone.id"

Re: [GENERAL] PL/SQL & unset custom variable

2009-09-02 Thread Tom Lane
Gordon Ross writes: > Sorry, no joy :-( > grails=> SELECT current_setting('phone.id'); > ERROR: unrecognized configuration parameter "phone.id" > grails=> SELECT coalesce(current_setting('phone.id'),'SYSTEM'); > ERROR: unrecognized configuration parameter "phone.id" You could use a SELECT fro

Re: [GENERAL] PL/SQL & unset custom variable

2009-09-02 Thread Gordon Ross
On 02/09/2009 15:39, "Andreas Kretschmer" wrote: > Gordon Ross wrote: >> Is there a way to either test if the custom variable is set, or to specify a >> global default for the custom variable ? > > I think, you can use COALESCE(your_variable, default_value) to solve > that problem. Try it, it is

Re: [GENERAL] PL/SQL & unset custom variable

2009-09-02 Thread Andreas Kretschmer
Gordon Ross wrote: > (I'm using Postgres 8.3) > > I have a trigger that references a custom variable. Most of the time this > custom variable is set, and I have no problems. > > However, in certain corner cases the custom variable is not set and the > trigger fails. > > Is there a way to eithe

[GENERAL] PL/SQL & unset custom variable

2009-09-02 Thread Gordon Ross
(I'm using Postgres 8.3) I have a trigger that references a custom variable. Most of the time this custom variable is set, and I have no problems. However, in certain corner cases the custom variable is not set and the trigger fails. Is there a way to either test if the custom variable is set, o