contrib/pg_freespacemap first check input argument, then relation_open.

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: contrib/pg_freespacemap first check input argument, then relation_open.
Date: 2023-07-06 02:14:46
Message-ID: CACJufxGYSniL_j1RVq4xv_ay0d5a0ZAhq2GkfXqeJ8L1SZqu7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-07-06 02:14:51 Re: Add index scan progress to pg_stat_progress_vacuum
Previous Message Masahiko Sawada 2023-07-06 02:07:14 Re: Add index scan progress to pg_stat_progress_vacuum