0ca3b1697added support for parallel TID Range Scans. The range of blocks to scan is stored in the shared phs_startblock and phs_numblock fields by the first participant to start the scan, but table_block_parallelscan_reinitialize() didn't reset these, so every rescan of the Gather reused the block range of the first execution. This caused rows to be silently missed when a rescan used a different TID range, e.g: SELECT r.lo, (SELECT count(*) FROM t WHERE ctid >= (SELECT r.lo)) FROM (VALUES ('(30,0)'::tid), ('(10,0)'), ('(0,0)')) r(lo); Here we fix this by resetting both fields in table_block_parallelscan_reinitialize(). As a side effect, a rescanned Parallel Seq Scan using synchronized scans now gets a new start location, which is what a new scan would do anyway. The existing rescan test didn't exercise this, so add one that does. This was introduced in0ca3b1697, so backpatch to v19. Reported-by: Zsolt Parragi <zsolt.parragi@percona.com> Author: Zsolt Parragi <zsolt.parragi@percona.com> Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Discussion: https://postgr.es/m/CAN4CZFOoyCQE483YVGg07_Vr2MjFCTiCLUHUAFCwKqJAE=PN6w@mail.gmail.com Backpatch-through: 19
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.