Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Pgadmin Support > Re: Removing Co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 9 Topic 1993 of 2158
Post > Topic >>

Re: Removing Context Messages

by fhevia@[EMAIL PROTECTED] ("Fernando Hevia") Apr 8, 2008 at 10:01 AM

------=_Part_16630_22639601.1207659704863
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tue, Apr 8, 2008 at 3:29 AM, Julius Tuskenis <julius@[EMAIL PROTECTED]
> 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.

------=_Part_16630_22639601.1207659704863
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<br><div class="gmail_quote">On Tue, Apr 8, 2008 at 3:29 AM, Julius
Tuskenis &lt;<a href="mailto:julius@[EMAIL PROTECTED]
">julius@[EMAIL PROTECTED]
>&gt;
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello.<br>
<br>
What do you mean saying CONTEXT messages? Could you give an example what
you get and what you want to get from your functions?<br>
<br>
<br></blockquote></div><br>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.<br>&nbsp;<br>Context messages appear immediately after the
f_inner function logs.<br>
The output I&#39;m getting when executing f_outer
is:<br>&nbsp;<br>NOTICE:&nbsp; f_outer: 3<br>NOTICE:&nbsp; f_inner: 3 =
[HEVIA]<br>CONTEXT:&nbsp; SQL statement &quot;SELECT&nbsp; f_inner( $1
)&quot;<br>PL/pgSQL function &quot;f_outer&quot; line 9 at perform<br>
NOTICE:&nbsp; f_outer: 6<br>NOTICE:&nbsp; f_inner: 6 =
[GUIDARA]<br>CONTEXT:&nbsp; SQL statement &quot;SELECT&nbsp; f_inner( $1
)&quot;<br>PL/pgSQL function &quot;f_outer&quot; line 9 at
perform<br>NOTICE:&nbsp; f_outer: 7<br>NOTICE:&nbsp; f_inner: 7 =
[MASTROIANI]<br>
CONTEXT:&nbsp; SQL statement &quot;SELECT&nbsp; f_inner( $1
)&quot;<br>PL/pgSQL function &quot;f_outer&quot; line 9 at perform&nbsp;
f_outer<br> <br><br>I want to get rid of the CONTEXT messages:<br>&nbsp;
CONTEXT:&nbsp; SQL statement &quot;SELECT&nbsp; f_inner( $1 )&quot;<br>
&nbsp; PL/pgSQL function &quot;f_outer&quot; line 9 at perform&nbsp;
f_outer<br> <br>&nbsp;<br>--- Function declaration follows in case it
helps --- <br>CREATE OR REPLACE FUNCTION f_inner(p_client numeric(10))
RETURNS void AS $BODY$ <br>
DECLARE<br>&nbsp; r_clients clientes%ROWTYPE;<br>BEGIN<br>&nbsp; SELECT *
INTO r_clients FROM clientes WHERE id_cliente = p_client;<br>&nbsp; RAISE
NOTICE &#39;f_inner: % = [%]&#39;, p_client, r_clients.apellido; <br>END;
<br>$BODY$ <br>
LANGUAGE &#39;plpgsql&#39; VOLATILE;<br>&nbsp;<br>CREATE OR REPLACE
FUNCTION f_outer() RETURNS void AS <br>$BODY$ <br>DECLARE<br>&nbsp;
r_clients clientes%ROWTYPE;<br>BEGIN<br>&nbsp; FOR r_clients IN SELECT *
FROM CLIENTES<br>&nbsp; LOOP<br>
&nbsp;&nbsp;&nbsp; RAISE NOTICE &#39;f_outer: %&#39;,
r_clients.id_cliente;<br>&nbsp;&nbsp;&nbsp; PERFORM
f_inner(r_clients.id_cliente);<br>&nbsp; END
LOOP;<br>END;<br>$BODY$<br>LANGUAGE &#39;plpgsql&#39;
VOLATILE;<br><br>Regards,<br>Fernando.<br>

------=_Part_16630_22639601.1207659704863--
 




 9 Posts in Topic:
Removing Context Messages
fhevia@[EMAIL PROTECTED]   2008-04-07 22:55:46 
Re: Removing Context Messages
mshapiro51@[EMAIL PROTECT  2008-04-07 21:01:19 
Re: Removing Context Messages
fhevia@[EMAIL PROTECTED]   2008-04-07 23:35:49 
Re: Removing Context Messages
guillaume@[EMAIL PROTECTE  2008-04-08 08:22:57 
Re: Removing Context Messages
julius@[EMAIL PROTECTED]   2008-04-08 09:29:00 
Re: Removing Context Messages
fhevia@[EMAIL PROTECTED]   2008-04-08 10:01:44 
Re: Removing Context Messages
fhevia@[EMAIL PROTECTED]   2008-04-08 10:08:27 
Re: Removing Context Messages
Erwin Brandstetter <br  2008-04-08 09:36:41 
Re: Removing Context Messages
fhevia@[EMAIL PROTECTED]   2008-04-08 14:19:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 17:15:41 CST 2008.