Re: Improper use about DatumGetInt32

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: 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: 2020-11-25T16:23:20Z
Lists: pgsql-hackers

Attachments

On 2020-11-02 16:59, Peter Eisentraut wrote:
> I have committed 0003.
> 
> For 0001, normal_rand(), I think you should reject negative arguments
> with an error.

I have committed a fix for that.

> For 0002, I think you should change the block number arguments to int8,
> same as other contrib modules do.

Looking further into this, almost all of pageinspect needs to be updated 
to handle block numbers larger than INT_MAX correctly.  Attached is a 
patch for this.  It is meant to work like other contrib modules, such as 
pg_freespace and pg_visibility.  I haven't tested this much yet.

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