mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Re-implement psql's FETCH_COUNT feature atop libpq's chunked mode.
Formerly this was done with a cursor, which is problematic since not all result-set-returning query types can be put into a cursor. The new implementation is better integrated into other psql features, too. Daniel Vérité, reviewed by Laurenz Albe and myself (and whacked around a bit by me, so any remaining bugs are my fault) Discussion: https://postgr.es/m/CAKZiRmxsVTkO928CM+-ADvsMyePmU3L9DQCa9NwqjvLPcEe5QA@mail.gmail.com
This commit is contained in:
@@ -1161,14 +1161,14 @@ SELECT 4 AS \gdesc
|
||||
\echo 'last error message:' :LAST_ERROR_MESSAGE
|
||||
\echo 'last error code:' :LAST_ERROR_SQLSTATE
|
||||
|
||||
-- check row count for a cursor-fetched query
|
||||
-- check row count for a query with chunked results
|
||||
\set FETCH_COUNT 10
|
||||
select unique2 from tenk1 order by unique2 limit 19;
|
||||
\echo 'error:' :ERROR
|
||||
\echo 'error code:' :SQLSTATE
|
||||
\echo 'number of rows:' :ROW_COUNT
|
||||
|
||||
-- cursor-fetched query with an error after the first group
|
||||
-- chunked results with an error after the first chunk
|
||||
select 1/(15-unique2) from tenk1 order by unique2 limit 19;
|
||||
\echo 'error:' :ERROR
|
||||
\echo 'error code:' :SQLSTATE
|
||||
|
||||
Reference in New Issue
Block a user