From: | David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Cc: | Fabien Coelho <postgresql(dot)org(at)coelho(dot)net> |
Subject: | Re: psql FETCH_COUNT feature does not work with combined queries |
Date: | 2020-07-16 23:08:08 |
Message-ID: | 159494088831.807.13347475451859514773.pgcf@coridan.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 line option or the \; meta-command). Additionally, it is possible for certain combinations of statements sent in that manner to 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. This combination in presently allowed for backward compatibility."
I would suggest, however, adding some tests in src/test/psql.sql demonstrating the broken behavior. A potentially useful test 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 select 1/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
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2020-07-16 23:24:42 | Re: psql FETCH_COUNT feature does not work with combined queries |
Previous Message | Hsu, John | 2020-07-16 22:54:49 | Re: Physical slot restart_lsn advances incorrectly requiring restore from archive |