Re: Trouble with FETCH_COUNT and combined queries in psql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Trouble with FETCH_COUNT and combined queries in psql
Дата
Msg-id 28929.1556027799@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Trouble with FETCH_COUNT and combined queries in psql  ("Daniel Verite" <daniel@manitou-mail.org>)
Ответы Re: Trouble with FETCH_COUNT and combined queries in psql  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: Trouble with FETCH_COUNT and combined queries in psql  ("Daniel Verite" <daniel@manitou-mail.org>)
Список pgsql-hackers
"Daniel Verite" <daniel@manitou-mail.org> writes:
>     Fabien COELHO wrote:
>> I added some stuff to extract embedded "\;" for pgbench "\cset", which has 
>> been removed though, but it is easy to add back a detection of "\;", and 
>> also to detect select. If the position of the last select is known, the 
>> cursor can be declared in the right place, which would also solve the 
>> problem.

> Thanks, I'll extract the necessary bits from your patch.
> I don't plan to go as far as injecting a DECLARE CURSOR inside
> the query, but rather just forbid the use of the cursor in
> the combined-queries case.

Keep in mind that a large part of the reason why the \cset patch got
bounced was exactly that its detection of \; was impossibly ugly
and broken.  Don't expect another patch using the same logic to
get looked on more favorably.

I'm not really sure how far we should go to try to make this case "work".
To my mind, use of \; in this way represents an intentional defeat of
psql's algorithms for deciding where end-of-query is.  If that ends up
in behavior you don't like, ISTM that's your fault not psql's.

Having said that, I did like the idea of maybe going over to
PQsetSingleRowMode instead of using an explicit cursor.  That
would represent a net decrease of cruftiness here, instead of
layering more cruft on top of what's already a mighty ugly hack.

However ... that'd require using PQsendQuery, which means that the
case at hand with \; would result in a server error rather than
surprising client-side behavior.  Is that an acceptable outcome?

            regards, tom lane



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

Предыдущее
От: Anastasia Lubennikova
Дата:
Сообщение: Re: block-level incremental backup
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: finding changed blocks using WAL scanning