Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/backend/utils/adt/dbsize.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,18 @@ pg_tablespace_size_name(PG_FUNCTION_ARGS)
static int64
calculate_relation_size(RelFileNode *rfn, BackendId backend, ForkNumber forknum, char relpersistence)
{
SMgrRelation srel = smgropen(*rfn, backend, relpersistence);
SMgrRelation srel;
RelFileNode zero = {0, 0, 0};

/*
* We can get asked the size of a relation without storage, in which case
* we get passed a zero RFL.
* Return 0 for those relations.
*/
if (RelFileNodeEquals(*rfn, zero))
return 0;

srel = smgropen(*rfn, backend, relpersistence);

if (smgrexists(srel, forknum))
{
Expand Down