pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stéphane DEWITTE <stephane@smeso.fr>
To: pgsql-sql@postgresql.org
Subject: How to log outputs from pl/pgsql into a file ?
Date: Fri, 19 Apr 2002 16:39:43 +0200
Message-ID: <NOEAIPGJHJIHECKNEIBGKEIFCOAA.stephane@smeso.fr> (raw)

Hi everybody.

I'm working un Linux SuSe7.0, Postgres 7.2 compiled from sources.

I have a function in PL/pgSQL and I have to write some infos on screen. For
that I use RAISE NOTICE ''Number %'',my_number;

It works fine on screen, but now I want to log it on a different file each
time (not the pog log). I've tried to make a shell (myshell) that calls the
script
psql mybase << EOF
select my_func();
EOF

and I make myshell > test.log

I only have the retrun of my function, and not the 'raise' that only appears
on screen. Idem if my shell is

psql mybase << EOF
\o test.log
select my_func();
EOF

and I have the same result. I guess it is possible ti have outputs written
into a file (like "spool file" in SqlPlus for Oracle) but I didn't find
anything on documentation for PL/pgSQL. Can I use raise notice for that ?
And how ? And what else can I use ?

Thanks a lot.

Regards,
Stephane.




view thread (2+ messages)  latest in thread

Message-ID: <NOEAIPGJHJIHECKNEIBGKEIFCOAA.stephane@smeso.fr>
Permalink:  ../NOEAIPGJHJIHECKNEIBGKEIFCOAA.stephane@smeso.fr/
Also on:    postgresql.org/message-id/NOEAIPGJHJIHECKNEIBGKEIFCOAA.stephane@smeso.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: stephane@smeso.fr
  Subject: Re: How to log outputs from pl/pgsql into a file ?
  In-Reply-To: <NOEAIPGJHJIHECKNEIBGKEIFCOAA.stephane@smeso.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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