pgsql: Check the snapshot argument of index_beginscan and family

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Check the snapshot argument of index_beginscan and family
Date: 2022-12-06 00:29:33
Message-ID: E1p2Lq0-002APQ-Sw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-12-06 01:54:52 pgsql: Generate pg_stat_get*() functions for tables using macros
Previous Message Michael Paquier 2022-12-06 00:20:46 pgsql: Provide test coverage in pg_dump for default behaviors with comp