Thread: pgsql: Check the snapshot argument of index_beginscan and family

pgsql: Check the snapshot argument of index_beginscan and family

From
Alexander Korotkov
Date:
Check the snapshot argument of index_beginscan and family

Passing a NULL snapshot (InvalidSnapshot) is going to work but only as long
as the index can't find any matching rows.  This can be confusing for
the extension authors, so add an explicit check for this argument.  The check
is implemented with Assert() in order to avoid overhead in release builds.

Reported-by: Sven Klemm
Discussion: https://postgr.es/m/CAJ7c6TPxitD4vbKyP-mpmC1XwyHdPPqvjLzm%2BVpB88h8LGgneQ%40mail.gmail.com
Author: Aleksander Alekseev
Reviewed-by: Pavel Borisov

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/941aa6a6268a6a66f6895401aad6b5329111d412

Modified Files
--------------
src/backend/access/index/indexam.c | 8 ++++++++
1 file changed, 8 insertions(+)