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

Commit4623d71

Browse files
committed
Prevent assertion failure in contrib/pg_freespacemap.
Applying pg_freespacemap() to a relation lacking storage (such as aview) caused an assertion failure, although there was no ill effectin non-assert builds. Add an error check for that case.Bug: #18866Reported-by: Robins Tharakan <tharakan@gmail.com>Author: Tender Wang <tndrwang@gmail.com>Reviewed-by: Euler Taveira <euler@eulerto.com>Discussion:https://postgr.es/m/18866-d68926d0f1c72d44@postgresql.orgBackpatch-through: 13
1 parentd66997d commit4623d71

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎contrib/pg_freespacemap/pg_freespacemap.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include"access/relation.h"
1212
#include"fmgr.h"
1313
#include"storage/freespace.h"
14+
#include"utils/rel.h"
1415

1516
PG_MODULE_MAGIC_EXT(
1617
.name="pg_freespacemap",
@@ -33,6 +34,13 @@ pg_freespace(PG_FUNCTION_ARGS)
3334

3435
rel=relation_open(relid,AccessShareLock);
3536

37+
if (!RELKIND_HAS_STORAGE(rel->rd_rel->relkind))
38+
ereport(ERROR,
39+
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
40+
errmsg("relation \"%s\" does not have storage",
41+
RelationGetRelationName(rel)),
42+
errdetail_relkind_not_supported(rel->rd_rel->relkind)));
43+
3644
if (blkno<0||blkno>MaxBlockNumber)
3745
ereport(ERROR,
3846
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp