Thread: Removing Context messages

Removing Context messages

From
"Fernando Hevia"
Date:
Hi list,

I'm having trouble removing some context messages in psql and/or pgadmin.
I made a simple example to show this with 2 functions: f_outer which loops
through a recordset and calls f_inner for each record.

Context messages appear only when the f_inner function logs. (Would be nice
to know why these CONTEXT notices appear).
This is the output I'm getting:

pg=> select f_outer();
NOTICE:  f_outer: 3
NOTICE:  f_inner: 3 = [HEVIA]
CONTEXT:  SQL statement "SELECT  f_inner( $1 )"
PL/pgSQL function "f_outer" line 9 at perform
NOTICE:  f_outer: 6
NOTICE:  f_inner: 6 = [GUIDARA]
CONTEXT:  SQL statement "SELECT  f_inner( $1 )"
PL/pgSQL function "f_outer" line 9 at perform
NOTICE:  f_outer: 7
NOTICE:  f_inner: 7 = [MASTROIANI]
CONTEXT:  SQL statement "SELECT  f_inner( $1 )"
PL/pgSQL function "f_outer" line 9 at perform
 f_outer
---------

(1 row)

I want to get rid of the CONTEXT messages.
I have tried in psql with "\set VERBOSITY terse" without success. No idea on
what to try on pgadmin though.

Thanks,
Fernando

--- Function declaration follows in case it helps ---
CREATE OR REPLACE FUNCTION f_inner(p_client numeric(10)) RETURNS void AS
$BODY$
DECLARE
  r_clients clientes%ROWTYPE;
BEGIN
  SELECT * INTO r_clients FROM clientes WHERE id_cliente = p_client;
  RAISE NOTICE 'f_inner: % = [%]', p_client, r_clients.apellido;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

CREATE OR REPLACE FUNCTION f_outer() RETURNS void AS
$BODY$
DECLARE
  r_clients clientes%ROWTYPE;
BEGIN
  FOR r_clients IN SELECT * FROM CLIENTES
  LOOP
    RAISE NOTICE 'f_outer: %', r_clients.id_cliente;
    PERFORM f_inner(r_clients.id_cliente);
  END LOOP;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;



Re: Removing Context messages

From
Tom Lane
Date:
"Fernando Hevia" <fhevia@ip-tel.com.ar> writes:
> I want to get rid of the CONTEXT messages.
> I have tried in psql with "\set VERBOSITY terse" without success.

Works for me ...

            regards, tom lane

Re: Removing Context messages

From
"Fernando Hevia"
Date:
> -----Mensaje original-----
> De: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Enviado el: Lunes, 07 de Abril de 2008 01:37
> Para: Fernando Hevia
> CC: pgsql-general@postgresql.org
> Asunto: Re: [GENERAL] Removing Context messages
>
> "Fernando Hevia" <fhevia@ip-tel.com.ar> writes:
> > I want to get rid of the CONTEXT messages.
> > I have tried in psql with "\set VERBOSITY terse" without success.
>
> Works for me ...
>
>             regards, tom lane

Found it. Variables are case sensitive and \set command must *not* be ended
with semi-colon. (I blundered here)
The correct syntax is:

pg=# \set VERBOSITY 'terse'


Thanks.