From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Alberto Benini <alberto(dot)benini(at)tasgroup(dot)eu> |
Cc: | pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>, cm <cm(at)tasgroup(dot)eu> |
Subject: | Re: PSQL: "\set ECHO all" doesn't work with "\o" |
Date: | 2022-02-23 18:27:08 |
Message-ID: | CAKFQuwaLF=nuUsn-0u9qqeneyqX4OGDUasC85xbWQqyaiGEmjg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, Feb 23, 2022 at 11:18 AM Alberto Benini <alberto(dot)benini(at)tasgroup(dot)eu>
wrote:
> Hi all,
>
> I haven’t understand how to redirect SQL errors on output file.
>
>
>
> Our goal is to have a psql script with:
>
>
>
> \set ON_ERROR_STOP true
>
> \set ECHO all
>
> \o log/update.log;
>
> \i update.sql;
>
>
>
>
>
> ..but in the log file we don’t see any sql error
>
>
>
You need to do this in your shell, IIRC:
psql [...] --file update.sql > log/update.log 2>&1
That trying to do the same with the \o meta-command fails should not be
surprising - the documentation explicitly says:
“Query results” includes all tables [...] but not error messages."
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Shaozhong SHI | 2022-02-27 10:39:17 | Is there any function for calculating angle between 2 line segments in 3D? |
Previous Message | Alberto Benini | 2022-02-23 18:18:14 | PSQL: "\set ECHO all" doesn't work with "\o" |