Re: Improper use about DatumGetInt32

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, Andres Freund <andres@anarazel.de>, "Hou, Zhijie" <houzj.fnst@cn.fujitsu.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2021-01-09T12:41:39Z
Lists: pgsql-hackers
On 2021-01-09 02:46, Michael Paquier wrote:
> +/* LCOV_EXCL_START */
> Does it really make sense to add those markers here?  It seems to me
> that we would ignore any new coverage if regression tests based on
> older versions are added (we may really want to have such tests for
> more in-core extensions to be able to verify the portability of an
> extension, but that's not the job of this patch of course).

If we had a way to do such testing then we wouldn't need these markers. 
But AFAICT, we don't.

> -       elog(ERROR, "block 0 is a meta page");
> +       ereport(ERROR,
> +               (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> +                errmsg("block 0 is a meta page")));
> [...]
> +                errmsg("block number %llu is out of range for relation \"%s\"",
> This does not follow the usual style for error reports that should not
> be written as full sentences?  Maybe something like "invalid block
> number %u referring to meta page" and "block number out of range for
> relation %s: %llu"?

There are many error messages that say "[something] is out of range".  I 
don't think banning that would serve any purpose.



Commits

  1. pageinspect: Change block number arguments to bigint

  2. tablefunc: Reject negative number of tuples passed to normal_rand()

  3. Use PG_GETARG_TRANSACTIONID where appropriate