Re: psql FETCH_COUNT feature does not work with combined queries

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: psql FETCH_COUNT feature does not work with combined queries
Дата
Msg-id 159494088831.807.13347475451859514773.pgcf@coridan.postgresql.org
обсуждение исходный текст
Ответ на Re: psql FETCH_COUNT feature does not work with combined queries  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: psql FETCH_COUNT feature does not work with combined queries  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  not tested
Implements feature:       not tested
Spec compliant:           not tested
Documentation:            tested, passed

Fabien,

There is a minor typo (works -> work) but overall I'm not a fan of the wording.

Instead of a note maybe add a paragraph stating:

"This setting is ignored when multiple statements are sent to the server as a single command (i.e., via the -c command
lineoption or the \; meta-command).  Additionally, it is possible for certain combinations of statements sent in that
mannerto instead return no results, or even be ignored, instead of returning the result set of the last query.  In
short,when FETCH_COUNT is non-zero, and you send a multi-statement command to the server, the results are undefined.
Thiscombination in presently allowed for backward compatibility."
 

I would suggest, however, adding some tests in src/test/psql.sql demonstrating the broken behavior.  A potentially
usefultest setup would be:
 
create temp table testtbl (idx int, div int);
insert into testtbl (1,1), (2,1),(3,1),(4,0),(5,1);
and combine that with FETCH_COUNT 3

Some other things I tried, with and without FETCH_COUNT:

begin \; select 2 \; commit \; select 1 / div from (select div from testtbl order by idx) as src;
select 1/0 \; select 1 / div from (select div from testtbl where div <> 0 order by idx) as src;
begin \; select 2 \; select 1 \; commit;
begin \; select 2 \; select 1;
commit;

I'm not sure how to go about getting a equivalent result of "select pg_sleep(2) \; select 1;" not sleeping.  If I put
select1/0 instead of pg_sleep I get an error and any DML seems to end up working just fine (minus actual batch
fetching)
update testtbl set val = 2 \; select 1; --result (1)

David J.

The new status of this patch is: Waiting on Author

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

Предыдущее
От: "Hsu, John"
Дата:
Сообщение: Re: Physical slot restart_lsn advances incorrectly requiring restore from archive
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: psql FETCH_COUNT feature does not work with combined queries