Re: Parser abort ignoring following commands

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Parser abort ignoring following commands
Дата
Msg-id 22487.990889951@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Parser abort ignoring following commands  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Parser abort ignoring following commands
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> psql -c 'select * from pg_class; select * from no_such_table;'
> Shouldn't this at least give me the result of the first select before
> aborting the second?

The behavior you are complaining of is not the backend's fault.
The reason it acts that way is that psql is feeding the entire -c 
string to the backend as one query, and not paying any attention
to the possibility that multiple query results might be available
from the string.

It's a little bit inconsistent that psql feeds a -c string to the
backend as one query, whereas the same input line fed to it from a file
or terminal would be split into per-statement queries.  However,
I'd vote against changing it, since (a) you might break existing
applications that depend on this behavior, and (b) if you do that then
there will be no way to exercise multi-statement query strings from
psql.

It might possibly make sense for psql to stop using PQexec() but
instead use PQsendQuery() and PQgetResult(), so that it could
handle multiple results coming back from a single query string.
If you did that then the first example would work the way you want.
        regards, tom lane


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Parser abort ignoring following commands
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Parser abort ignoring following commands