Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit267ccc3

Browse files
committed
Check syscache result in AlterStatistics
The syscache lookup may return NULL even for valid OID, for example dueto 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 ALTERSTATISTICS ... SET STATISTICS was introduced.Backpatch-through: 13Discussion:https://postgr.es/m/17372-bf3b6e947e35ae77%40postgresql.org
1 parent31b7b4d commit267ccc3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎src/backend/commands/statscmds.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ AlterStatistics(AlterStatsStmt *stmt)
493493
rel=table_open(StatisticExtRelationId,RowExclusiveLock);
494494

495495
oldtup=SearchSysCache1(STATEXTOID,ObjectIdGetDatum(stxoid));
496+
if (!HeapTupleIsValid(oldtup))
497+
elog(ERROR,"cache lookup failed for extended statistics object %u",stxoid);
496498

497499
/* Must be owner of the existing statistics object */
498500
if (!pg_statistics_object_ownercheck(stxoid,GetUserId()))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp