Re: psql -af > out, is possible to also have raise notice, raise info part. - Mailing list pgsql-general

From David G. Johnston
Subject Re: psql -af > out, is possible to also have raise notice, raise info part.
Date
Msg-id CAKFQuwaiOYoRYfVPPQfjzsAZqVEfUVQ-7F3Dtev2Lq3FfQOOJA@mail.gmail.com
Whole thread Raw
In response to psql -af > out, is possible to also have raise notice, raise info part.  (jian he <jian.universality@gmail.com>)
Responses Re: psql -af > out, is possible to also have raise notice, raise info part.  (jian he <jian.universality@gmail.com>)
List pgsql-general
On Tue, Jul 11, 2023 at 8:52 PM jian he <jian.universality@gmail.com> wrote:
hi.

test.sql content:
--------------------------------------------------------------------------------------------------
do $$
begin
  raise info 'information message %', now() ;
  raise debug 'debug message %', now();
  raise notice 'notice message %', now();
end $$;
--------------------------------------------------------------------------------------------------
psql -af test.sql > test.out


You've only redirected stdout (file # 1 - implied), the "raise" stuff goes to stderr (file # 2)

IIRC you can do:

psql -af test.sql > test.out 2>&1

(order matters, left-to-right)

But you can search online for "output redirection in Linux" or some such if you want to learn the Linux command line better.

David J.

pgsql-general by date:

Previous
From: jian he
Date:
Subject: psql -af > out, is possible to also have raise notice, raise info part.
Next
From: jian he
Date:
Subject: Re: psql -af > out, is possible to also have raise notice, raise info part.