Re: PSQL: "\set ECHO all" doesn't work with "\o"

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: PSQL: "\set ECHO all" doesn't work with "\o"
Дата
Msg-id CAKFQuwaLF=nuUsn-0u9qqeneyqX4OGDUasC85xbWQqyaiGEmjg@mail.gmail.com
обсуждение исходный текст
Ответ на PSQL: "\set ECHO all" doesn't work with "\o"  (Alberto Benini <alberto.benini@tasgroup.eu>)
Список pgsql-sql
On Wed, Feb 23, 2022 at 11:18 AM Alberto Benini <alberto.benini@tasgroup.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.

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

Предыдущее
От: Alberto Benini
Дата:
Сообщение: PSQL: "\set ECHO all" doesn't work with "\o"
Следующее
От: Shaozhong SHI
Дата:
Сообщение: Is there any function for calculating angle between 2 line segments in 3D?