Re: psql: backslash fix

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: psql: backslash fix
Дата
Msg-id Pine.LNX.4.30.0203111704530.690-100000@peter.localdomain
обсуждение исходный текст
Ответ на psql: backslash fix  (nconway@klamath.dyndns.org (Neil Conway))
Ответы Re: psql: backslash fix  (Neil Conway <nconway@klamath.dyndns.org>)
Список pgsql-patches
Neil Conway writes:

> Recently, I reported on -hackers a strange case where psql wouldn't
> reset it's query buffer properly on a malformed backslash command, which
> would mean that the next query wouldn't be parsed properly. For
> instance:
>
> nconway=> select foo\\bar;
> Invalid command \. Try \? for help.
> nconway-> select 1;
> ERROR:  parser: parse error at or near "select"

This is the correct behavior.

> I've attached a patch which fixes this. I'm not sure if it is the
> "right" way to fix it, but it resolves the situation discribed above, at
> least. The new behavior is:
>
> nconway=> select foo\\bar;
> Invalid command \. Try \? for help.
> ERROR:  Attribute 'foo' not found
> nconway=> select 1;
>  ?column?
>  ----------
>          1

The semicolon belongs to the backslash command.  Where did this get the
idea that the query buffer should be executed?  You could clear the query
buffer on a failed backslash command, but I wouldn't like that.

--
Peter Eisentraut   peter_e@gmx.net


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

Предыдущее
От: nconway@klamath.dyndns.org (Neil Conway)
Дата:
Сообщение: psql: backslash fix
Следующее
От: Neil Conway
Дата:
Сообщение: Re: psql: backslash fix