From: | "Fernando Hevia" <fhevia(at)gmail(dot)com> |
---|---|
To: | "Julius Tuskenis" <julius(at)nsoft(dot)lt> |
Cc: | pgadmin-support(at)postgresql(dot)org |
Subject: | Re: Removing Context Messages |
Date: | 2008-04-08 13:01:44 |
Message-ID: | b9e2597c0804080601qe485ad2ia874e25756b87bc1@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support |
On Tue, Apr 8, 2008 at 3:29 AM, Julius Tuskenis <julius(at)nsoft(dot)lt> wrote:
> Hello.
>
> What do you mean saying CONTEXT messages? Could you give an example what
> you get and what you want to get from your functions?
>
>
>
Sure. I have 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 immediately after the f_inner function logs.
The output I'm getting when executing f_outer is:
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
I want to get rid of the CONTEXT messages:
CONTEXT: SQL statement "SELECT f_inner( $1 )"
PL/pgSQL function "f_outer" line 9 at perform f_outer
--- 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;
Regards,
Fernando.
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Hevia | 2008-04-08 13:08:27 | Re: Removing Context Messages |
Previous Message | Melvin Davidson | 2008-04-08 12:54:55 | Re: Is Changing database Name possible ? |