pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
[PATCH v5 1/4] fix priv checks in stats code 1+ messages / 1 participants [nested] [flat]
* [PATCH v5 1/4] fix priv checks in stats code @ 2025-09-24 14:24 Nathan Bossart <nathan@postgresql.org> 0 siblings, 0 replies; 1+ messages in thread From: Nathan Bossart @ 2025-09-24 14:24 UTC (permalink / raw) --- src/backend/statistics/stat_utils.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/backend/statistics/stat_utils.c b/src/backend/statistics/stat_utils.c index ef7e5168bed..8b8203a58e3 100644 --- a/src/backend/statistics/stat_utils.c +++ b/src/backend/statistics/stat_utils.c @@ -189,6 +189,17 @@ stats_lock_check_privileges(Oid reloid) Assert(index->rd_index && index->rd_index->indrelid == table_oid); + /* + * Since we did the IndexGetRelation() call above without any lock, + * it's barely possible that a race against an index drop/recreation + * could have netted us the wrong table. + */ + if (table_oid != IndexGetRelation(index_oid, true)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_TABLE), + errmsg("could not find parent table of index \"%s\"", + RelationGetRelationName(index)))); + /* retain lock on index */ relation_close(index, NoLock); } -- 2.39.5 (Apple Git-154) --fHRxQ/rtkbDAFFP4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v5-0002-fix-priv-checks-in-index-code.patch ^ permalink raw reply [nested|flat] 1+ messages in thread
only message in thread Thread overview: 1+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-09-24 14:24 [PATCH v5 1/4] fix priv checks in stats code Nathan Bossart <nathan@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox