Re: Bug fix for psql's meta-command \ev

Поиск
Список
Период
Сортировка
От Kyotaro Horiguchi
Тема Re: Bug fix for psql's meta-command \ev
Дата
Msg-id 20230915.151750.1163612305682721014.horikyota.ntt@gmail.com
обсуждение исходный текст
Ответ на Bug fix for psql's meta-command \ev  (Ryoga Yoshida <bt23yoshidar@oss.nttdata.com>)
Ответы Re: Bug fix for psql's meta-command \ev  (Aleksander Alekseev <aleksander@timescale.com>)
Список pgsql-hackers
At Fri, 15 Sep 2023 11:37:46 +0900, Ryoga Yoshida <bt23yoshidar@oss.nttdata.com> wrote in 
> I think this is a bug in psql's \ev meta-command. Even when \ev fails,
> it should not leave the garbage string in psql's query buffer and the
> following query should be completed successfully.

Good catch! I agree to this.

> This problem can be resolved by resetting the query buffer on
> error. You can see the attached source code. After that, it will
> result in output like the following:

While exec_command_ef_ev() currently preserves the existing content of
the query buffer in case of certain failures, This behavior doesn't
seem to be particularly significant, especially given that both \ef
and \ev are intended to overwrite the query buffer on success.

We have the option to fix get_create_object_cmd() and ensure
exec_command_ef_ev() retains the existing content of the query buffer
on failure. However, this approach seems like overly cumbersome. So
I'm +1 to this approach.

A comment might be necessary to clarify that we need to wipe out the
query buffer because it could be overwritten with an incomplete query
string due to certain failures.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: [PoC] pg_upgrade: allow to upgrade publisher node
Следующее
От: "Lepikhov Andrei"
Дата:
Сообщение: Re: RFC: Logging plan of the running query