From: | Andreas Kretschmer <akretschmer(at)spamfence(dot)net> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: print statements? |
Date: | 2006-12-19 16:37:45 |
Message-ID: | 20061219163745.GA9616@KanotixBox |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
tlm <tlm1905(at)gmail(dot)com> schrieb:
> [ 2nd try ]
>
> Hi. I have an automated script that essentially feeds a long sequence of SQL
> statements to psql, as a single transaction. For debugging purposes, I would
> like to insert the equivalent of print statements (to write messages to stdout,
> stderr, or maybe some pre-specified log file) at various points in this
> sequence. How is this done?
One solution: write a little function to write out there parameter via
RAISE NOTICE and call this function on the desired places.
I mean something tike this:
test=# create function write_out(text) returns void as $$ begin raise notice '%',$1; end; $$ language plpgsql immutable strict;
CREATE FUNCTION
test=#
test=# select write_out('hint');
NOTICE: hint
write_out
-----------
(1 row)
and set 'log_min_messages = notice', then can you find your messages in
the log-file.
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
From | Date | Subject | |
---|---|---|---|
Next Message | Chandra Sekhar Surapaneni | 2006-12-19 18:54:30 | Re: Getting a count from an update |
Previous Message | Brandon Aiken | 2006-12-19 16:27:03 | Re: print statements? |