Re: [PATCH] Add min() and max() aggregate functions for xid8 - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: [PATCH] Add min() and max() aggregate functions for xid8
Date
Msg-id 69d9da54-7066-dcc2-5efd-5fdad139bc40@oss.nttdata.com
Whole thread Raw
In response to [PATCH] Add min() and max() aggregate functions for xid8  (Ken Kato <katouknl@oss.nttdata.com>)
Responses Re: [PATCH] Add min() and max() aggregate functions for xid8  (Ken Kato <katouknl@oss.nttdata.com>)
List pgsql-hackers

On 2022/02/03 16:45, Ken Kato wrote:
> Hi hackers,
> 
> Unlike xid, xid8 increases monotonically and cannot be reused.
> This trait makes it possible to support min() and max() aggregate functions for xid8.
> I thought they would be useful for monitoring.
> 
> So I made a patch for this.

Thanks for the patch! +1 with this feature.

+    PG_RETURN_FULLTRANSACTIONID((U64FromFullTransactionId(fxid1) > U64FromFullTransactionId(fxid2)) ? fxid1 : fxid2);

Shouldn't we use FullTransactionIdFollows() to compare those two fxid values here, instead?

+    PG_RETURN_FULLTRANSACTIONID((U64FromFullTransactionId(fxid1) < U64FromFullTransactionId(fxid2)) ? fxid1 : fxid2);

Shouldn't we use FullTransactionIdPrecedes() to compare those two fxid values here, instead?

Could you add the regression tests for those min() and max() functions for xid8?

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Extensible Rmgr for Table AMs
Next
From: Alvaro Herrera
Date:
Subject: Re: [BUG]Update Toast data failure in logical replication