contrib/pg_freespacemap first check input argument, then relation_open. - Mailing list pgsql-hackers

From jian he
Subject contrib/pg_freespacemap first check input argument, then relation_open.
Date
Msg-id CACJufxGYSniL_j1RVq4xv_ay0d5a0ZAhq2GkfXqeJ8L1SZqu7Q@mail.gmail.com
Whole thread Raw
Responses Re: contrib/pg_freespacemap first check input argument, then relation_open.
List pgsql-hackers

Hi.

In: https://git.postgresql.org/cgit/postgresql.git/tree/contrib/pg_freespacemap/pg_freespacemap.c

rel = relation_open(relid, AccessShareLock);

if (blkno < 0 || blkno > MaxBlockNumber)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid block number")));

--------------------
should it first check input arguments, then relation_open? 
Does ereport automatically unlock the relation? 

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Add index scan progress to pg_stat_progress_vacuum
Next
From: Michael Paquier
Date:
Subject: Re: Add index scan progress to pg_stat_progress_vacuum