pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
CONTEXT on PL/pgSQL
4+ messages / 3 participants
[nested] [flat]

* CONTEXT on PL/pgSQL
@ 2004-04-23 13:18 Martin Marques <martin@bugs.unl.edu.ar>
  2004-04-23 14:18 ` Re: CONTEXT on PL/pgSQL Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Martin Marques @ 2004-04-23 13:18 UTC (permalink / raw)
  To: pgsql-sql

I have a simple function made with PL/pgSQL and when I call it I get this in 
the logs:

2004-04-23 10:15:32 [30669] LOG:  statement: SELECT nodoSuperior(22) AS sup
2004-04-23 10:15:32 [30669] LOG:  statement: SELECT  $1
CONTEXT:  PL/pgSQL function "nodosuperior" line 7 at assignment
2004-04-23 10:15:32 [30669] LOG:  statement: SELECT  codigo,padre,nombre FROM 
procesos WHERE codigo= $1
CONTEXT:  PL/pgSQL function "nodosuperior" line 10 at select into variables
2004-04-23 10:15:32 [30669] LOG:  statement: SELECT   $1  IS NULL
CONTEXT:  PL/pgSQL function "nodosuperior" line 12 at exit
2004-04-23 10:15:32 [30669] LOG:  statement: SELECT   $1
CONTEXT:  PL/pgSQL function "nodosuperior" line 16 at return

What does CONTEXT mean, and is everything ok?

The function is this:

CREATE OR REPLACE FUNCTION nodoSuperior(INT) RETURNS VARCHAR AS '
DECLARE
COD INT;
SUP RECORD;

BEGIN

COD:=$1;

LOOP
	SELECT INTO SUP codigo,padre,nombre 
		FROM procesos WHERE codigo=COD;
	EXIT WHEN SUP.padre IS NULL;
	COD:=SUP.padre;
END LOOP;

RETURN SUP.nombre;
END;
' LANGUAGE 'plpgsql';

-- 
 10:16:01 up 45 days, 14:40,  3 users,  load average: 0.54, 0.61, 0.63
-----------------------------------------------------------------
Martín Marqués        | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
             Universidad Nacional
                  del Litoral
-----------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: CONTEXT on PL/pgSQL
  2004-04-23 13:18 CONTEXT on PL/pgSQL Martin Marques <martin@bugs.unl.edu.ar>
@ 2004-04-23 14:18 ` Tom Lane <tgl@sss.pgh.pa.us>
  2004-04-23 15:07   ` Re: CONTEXT on PL/pgSQL Martin Marques <martin@bugs.unl.edu.ar>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2004-04-23 14:18 UTC (permalink / raw)
  To: Martin Marques <martin@bugs.unl.edu.ar>; +Cc: pgsql-sql

Martin Marques <martin@bugs.unl.edu.ar> writes:
> I have a simple function made with PL/pgSQL and when I call it I get this in 
> the logs:

> 2004-04-23 10:15:32 [30669] LOG:  statement: SELECT nodoSuperior(22) AS sup
> 2004-04-23 10:15:32 [30669] LOG:  statement: SELECT  $1
> CONTEXT:  PL/pgSQL function "nodosuperior" line 7 at assignment

log_statement currently logs everything the parser sees, which includes
SQL commands generated by plpgsql.

Arguably these facilities should be separated, but until someone
makes a serious effort to provide plpgsql debugging features,
it's likely that nothing will be done about it.  Right now this is
almost the only technique available for seeing what's going on inside
a plpgsql function, and crummy as it is, it's better than nothing...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: CONTEXT on PL/pgSQL
  2004-04-23 13:18 CONTEXT on PL/pgSQL Martin Marques <martin@bugs.unl.edu.ar>
  2004-04-23 14:18 ` Re: CONTEXT on PL/pgSQL Tom Lane <tgl@sss.pgh.pa.us>
@ 2004-04-23 15:07   ` Martin Marques <martin@bugs.unl.edu.ar>
  2004-05-07 23:50     ` Re: CONTEXT on PL/pgSQL Gaetano Mendola <mendola@bigfoot.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Martin Marques @ 2004-04-23 15:07 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

El Vie 23 Abr 2004 11:18, Tom Lane escribió:
> Martin Marques <martin@bugs.unl.edu.ar> writes:
> > I have a simple function made with PL/pgSQL and when I call it I get this
> > in the logs:
> >
> > 2004-04-23 10:15:32 [30669] LOG:  statement: SELECT nodoSuperior(22) AS
> > sup 2004-04-23 10:15:32 [30669] LOG:  statement: SELECT  $1
> > CONTEXT:  PL/pgSQL function "nodosuperior" line 7 at assignment
>
> log_statement currently logs everything the parser sees, which includes
> SQL commands generated by plpgsql.
>
> Arguably these facilities should be separated, but until someone
> makes a serious effort to provide plpgsql debugging features,
> it's likely that nothing will be done about it.  Right now this is
> almost the only technique available for seeing what's going on inside
> a plpgsql function, and crummy as it is, it's better than nothing...

So the CONTEXT line just tells where the statement was made?

-- 
 12:06:01 up 45 days, 16:30,  2 users,  load average: 0.50, 0.46, 0.45
-----------------------------------------------------------------
Martín Marqués        | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
             Universidad Nacional
                  del Litoral
-----------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: CONTEXT on PL/pgSQL
  2004-04-23 13:18 CONTEXT on PL/pgSQL Martin Marques <martin@bugs.unl.edu.ar>
  2004-04-23 14:18 ` Re: CONTEXT on PL/pgSQL Tom Lane <tgl@sss.pgh.pa.us>
  2004-04-23 15:07   ` Re: CONTEXT on PL/pgSQL Martin Marques <martin@bugs.unl.edu.ar>
@ 2004-05-07 23:50     ` Gaetano Mendola <mendola@bigfoot.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Gaetano Mendola @ 2004-05-07 23:50 UTC (permalink / raw)
  To: Martin Marques <martin@bugs.unl.edu.ar>

Martin Marques wrote:

 > El Vie 23 Abr 2004 11:18, Tom Lane escribió:
 >
 >>Martin Marques <martin@bugs.unl.edu.ar> writes:
 >>
 >>>I have a simple function made with PL/pgSQL and when I call it I get this
 >>>in the logs:
 >>>
 >>>2004-04-23 10:15:32 [30669] LOG:  statement: SELECT nodoSuperior(22) AS
 >>>sup 2004-04-23 10:15:32 [30669] LOG:  statement: SELECT  $1
 >>>CONTEXT:  PL/pgSQL function "nodosuperior" line 7 at assignment
 >>
 >>log_statement currently logs everything the parser sees, which includes
 >>SQL commands generated by plpgsql.
 >>
 >>Arguably these facilities should be separated, but until someone
 >>makes a serious effort to provide plpgsql debugging features,
 >>it's likely that nothing will be done about it.  Right now this is
 >>almost the only technique available for seeing what's going on inside
 >>a plpgsql function, and crummy as it is, it's better than nothing...
 >
 >
 > So the CONTEXT line just tells where the statement was made?

U'r right, you can get rid of that CONTEXT configuring postgresql
with

    log_error_verbosity = terse





Regards
Gaetano Mendola






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2004-05-07 23:50 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 13:18 CONTEXT on PL/pgSQL Martin Marques <martin@bugs.unl.edu.ar>
2004-04-23 14:18 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-04-23 15:07   ` Martin Marques <martin@bugs.unl.edu.ar>
2004-05-07 23:50     ` Gaetano Mendola <mendola@bigfoot.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox