pgsql: Check syscache result in AlterStatistics

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Check syscache result in AlterStatistics
Date: 2022-01-23 02:22:39
Message-ID: E1nBSWd-00080r-7D@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Check syscache result in AlterStatistics

The syscache lookup may return NULL even for valid OID, for example due
to a concurrent DROP STATISTICS, so a HeapTupleIsValid is necessary.
Without it, it may fail with a segfault.

Reported by Alexander Lakhin, patch by me. Backpatch to 13, where ALTER
STATISTICS ... SET STATISTICS was introduced.

Backpatch-through: 13
Discussion: https://postgr.es/m/17372-bf3b6e947e35ae77%40postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/267ccc38ba6a95889d98959f183de64ceff23087

Modified Files
--------------
src/backend/commands/statscmds.c | 2 ++
1 file changed, 2 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2022-01-23 03:10:57 pgsql: Correct type of front_pathkey to PathKey
Previous Message Tomas Vondra 2022-01-23 02:17:36 pgsql: Check syscache result in AlterStatistics