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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: psql -af > out, is possible to also have raise notice, raise info part.
Date: 2023-07-12 04:05:51
Message-ID: CAKFQuwaiOYoRYfVPPQfjzsAZqVEfUVQ-7F3Dtev2Lq3FfQOOJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 11, 2023 at 8:52 PM jian he <jian(dot)universality(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message jian he 2023-07-12 04:27:02 Re: psql -af > out, is possible to also have raise notice, raise info part.
Previous Message jian he 2023-07-12 03:52:26 psql -af > out, is possible to also have raise notice, raise info part.