pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to log outputs from pl/pgsql into a file ?
2+ messages / 2 participants
[nested] [flat]

* How to log outputs from pl/pgsql into a file ?
@ 2002-04-19 14:39 Stéphane DEWITTE <stephane@smeso.fr>
  0 siblings, 0 replies; 2+ messages in thread

From: Stéphane DEWITTE @ 2002-04-19 14:39 UTC (permalink / raw)
  To: pgsql-sql

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.




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

* Re: How to log outputs from pl/pgsql into a file ?
@ 2002-04-19 18:32 Jie Liang <jie@stbernard.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jie Liang @ 2002-04-19 18:32 UTC (permalink / raw)
  To: 'Stéphane DEWITTE' <stephane@smeso.fr>; pgsql-sql

You might try:

./myshell 2>&1|tee test.log

Jie Liang


-----Original Message-----
From: Stéphane DEWITTE [mailto:stephane@smeso.fr]
Sent: Friday, April 19, 2002 7:40 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] How to log outputs from pl/pgsql into a file ?


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.


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



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


end of thread, other threads:[~2002-04-19 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-19 14:39 How to log outputs from pl/pgsql into a file ? Stéphane DEWITTE <stephane@smeso.fr>
2002-04-19 18:32 Re: How to log outputs from pl/pgsql into a file ? Jie Liang <jie@stbernard.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