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

Commitdb8238d

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 parente5cf186 commitdb8238d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎contrib/pg_freespacemap/pg_freespacemap.c

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

1516
PG_MODULE_MAGIC;
1617

@@ -30,6 +31,12 @@ pg_freespace(PG_FUNCTION_ARGS)
3031

3132
rel=relation_open(relid,AccessShareLock);
3233

34+
if (!RELKIND_HAS_STORAGE(rel->rd_rel->relkind))
35+
ereport(ERROR,
36+
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
37+
errmsg("relation \"%s\" does not have storage",
38+
RelationGetRelationName(rel))));
39+
3340
if (blkno<0||blkno>MaxBlockNumber)
3441
ereport(ERROR,
3542
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp