pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
echo/printf function in plpgsql
7+ messages / 4 participants
[nested] [flat]

* echo/printf function in plpgsql
@ 2005-07-19 14:51  Andreas Joseph Krogh <andreak@officenet.no>
  0 siblings, 1 reply; 7+ messages in thread

From: Andreas Joseph Krogh @ 2005-07-19 14:51 UTC (permalink / raw)
  To: pgsql-sql

Hi all!

Is there a way of echo'ing a string(like "raise notice 'this is id%', id") 
from plpgsql? I want to echo/print it to STDOUT 'cause the notice-mechanism 
produces too much noise IMH.

--
Andreas



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

* Re: echo/printf function in plpgsql
@ 2005-07-19 15:18  Richard Huxton <dev@archonet.com>
  parent: Andreas Joseph Krogh <andreak@officenet.no>
  0 siblings, 1 reply; 7+ messages in thread

From: Richard Huxton @ 2005-07-19 15:18 UTC (permalink / raw)
  To: Andreas Joseph Krogh <andreak@officenet.no>; +Cc: pgsql-sql

Andreas Joseph Krogh wrote:
> Hi all!
> 
> Is there a way of echo'ing a string(like "raise notice 'this is id%', id") 
> from plpgsql? I want to echo/print it to STDOUT 'cause the notice-mechanism 
> produces too much noise IMH.

Your function is running in the backend. You don't have a STDOUT 
(although you might have redirected STDERR for logging).

--
   Richard Huxton
   Archonet Ltd



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

* Re: echo/printf function in plpgsql
@ 2005-07-19 15:58  Andreas Joseph Krogh <andreak@officenet.no>
  parent: Richard Huxton <dev@archonet.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Andreas Joseph Krogh @ 2005-07-19 15:58 UTC (permalink / raw)
  To: pgsql-sql

On Tuesday 19 July 2005 17:18, Richard Huxton wrote:
> Andreas Joseph Krogh wrote:
> > Hi all!
> >
> > Is there a way of echo'ing a string(like "raise notice 'this is id%',
> > id") from plpgsql? I want to echo/print it to STDOUT 'cause the
> > notice-mechanism produces too much noise IMH.
>
> Your function is running in the backend. You don't have a STDOUT
> (although you might have redirected STDERR for logging).

I see. Can I make the ouput somehow less verbose? It spits out a lot of noise 
for each "NOTICE":
====================
psql:ocs_process_projecct.sql:48: NOTICE:  trying to insert parent_id: 87, 
child_id: 91
CONTEXT:  SQL statement "SELECT  processSubProject( $1 ,  $2 ,  $3 )"
PL/pgSQL function "processsubproject" line 7 at perform
SQL statement "SELECT  processSubProject( $1 ,  $2 ,  $3 )"
PL/pgSQL function "processsubproject" line 7 at perform
SQL statement "SELECT  processSubProject( $1 ,  $2 ,  $3 )"
PL/pgSQL function "build_project_children" line 11 at perform
====================

--
AJk



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

* Re: echo/printf function in plpgsql
@ 2005-07-19 20:09  Tony Wasson <ajwasson@gmail.com>
  parent: Andreas Joseph Krogh <andreak@officenet.no>
  1 sibling, 1 reply; 7+ messages in thread

From: Tony Wasson @ 2005-07-19 20:09 UTC (permalink / raw)
  To: Andreas Joseph Krogh <andreak@officenet.no>; +Cc: pgsql-sql

On 7/19/05, Andreas Joseph Krogh <andreak@officenet.no> wrote:
> On Tuesday 19 July 2005 17:18, Richard Huxton wrote:
> > Andreas Joseph Krogh wrote:
> > > Hi all!
> > >
> > > Is there a way of echo'ing a string(like "raise notice 'this is id%',
> > > id") from plpgsql? I want to echo/print it to STDOUT 'cause the
> > > notice-mechanism produces too much noise IMH.
> >
> > Your function is running in the backend. You don't have a STDOUT
> > (although you might have redirected STDERR for logging).
> 
> I see. Can I make the ouput somehow less verbose? It spits out a lot of noise
> for each "NOTICE":

You can control the severity messages sent to your client by first
setting client_min_message.

Try SET client_min_messages = WARNING;

http://www.postgresql.org/docs/8.0/interactive/runtime-config.html

Tony



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

* Re: echo/printf function in plpgsql
@ 2005-07-19 20:36  Andreas Joseph Krogh <andreak@officenet.no>
  parent: Tony Wasson <ajwasson@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Andreas Joseph Krogh @ 2005-07-19 20:36 UTC (permalink / raw)
  To: pgsql-sql@postgresql.org, Tony Wasson <ajwasson@gmail.com>

On Tuesday 19 July 2005 22:09, Tony Wasson wrote:
> On 7/19/05, Andreas Joseph Krogh <andreak@officenet.no> wrote:
> > On Tuesday 19 July 2005 17:18, Richard Huxton wrote:
> > > Andreas Joseph Krogh wrote:
> > > > Hi all!
> > > >
> > > > Is there a way of echo'ing a string(like "raise notice 'this is id%',
> > > > id") from plpgsql? I want to echo/print it to STDOUT 'cause the
> > > > notice-mechanism produces too much noise IMH.
> > >
> > > Your function is running in the backend. You don't have a STDOUT
> > > (although you might have redirected STDERR for logging).
> >
> > I see. Can I make the ouput somehow less verbose? It spits out a lot of
> > noise for each "NOTICE":
>
> You can control the severity messages sent to your client by first
> setting client_min_message.
>
> Try SET client_min_messages = WARNING;

Thanks

--
AJK



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

* Re: echo/printf function in plpgsql
@ 2005-07-19 23:39  John DeSoi <desoi@pgedit.com>
  parent: Andreas Joseph Krogh <andreak@officenet.no>
  1 sibling, 1 reply; 7+ messages in thread

From: John DeSoi @ 2005-07-19 23:39 UTC (permalink / raw)
  To: Andreas Joseph Krogh <andreak@officenet.no>; +Cc: pgsql-sql


On Jul 19, 2005, at 11:58 AM, Andreas Joseph Krogh wrote:

> I see. Can I make the ouput somehow less verbose? It spits out a  
> lot of noise
> for each "NOTICE":

If you just want to output some information to the log, you can use  
something like this:

raise log 't is %', t;

If I recall correctly, the values to be inserted into the format  
string can only be variables, not expressions.



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL




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

* Re: echo/printf function in plpgsql
@ 2005-07-20 07:21  Andreas Joseph Krogh <andreak@officenet.no>
  parent: John DeSoi <desoi@pgedit.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Andreas Joseph Krogh @ 2005-07-20 07:21 UTC (permalink / raw)
  To: pgsql-sql

On Wednesday 20 July 2005 01:39, John DeSoi wrote:
> On Jul 19, 2005, at 11:58 AM, Andreas Joseph Krogh wrote:
> > I see. Can I make the ouput somehow less verbose? It spits out a
> > lot of noise
> > for each "NOTICE":
>
> If you just want to output some information to the log, you can use
> something like this:
>
> raise log 't is %', t;
>
> If I recall correctly, the values to be inserted into the format
> string can only be variables, not expressions.

Thanks!

--
AJK



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


end of thread, other threads:[~2005-07-20 07:21 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-19 14:51 echo/printf function in plpgsql Andreas Joseph Krogh <andreak@officenet.no>
2005-07-19 15:18 ` Richard Huxton <dev@archonet.com>
2005-07-19 15:58   ` Andreas Joseph Krogh <andreak@officenet.no>
2005-07-19 20:09     ` Tony Wasson <ajwasson@gmail.com>
2005-07-19 20:36       ` Andreas Joseph Krogh <andreak@officenet.no>
2005-07-19 23:39     ` John DeSoi <desoi@pgedit.com>
2005-07-20 07:21       ` Andreas Joseph Krogh <andreak@officenet.no>

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