Re: print statements?

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: print statements?
Дата
Msg-id 20061219163745.GA9616@KanotixBox
обсуждение исходный текст
Ответ на print statements?  (tlm <tlm1905@gmail.com>)
Список pgsql-novice
tlm <tlm1905@gmail.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°

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Brandon Aiken"
Дата:
Сообщение: Re: print statements?
Следующее
От: "Chandra Sekhar Surapaneni"
Дата:
Сообщение: Re: Getting a count from an update