mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Add min() and max() aggregates for pg_lsn
This is useful for monitoring, when it comes for example to calculations of WAL retention with replication slots and delays with a set of standbys. Bump catalog version. Author: Fabrízio de Royes Mello Reviewed-by: Surafel Temesgen Discussion: https://postgr.es/m/CAFcNs+oc8ZoHhowA4rR1GGCgG8QNgK_TOwPRVYQo5rYy8_PXzA@mail.gmail.com
This commit is contained in:
@@ -171,6 +171,24 @@ pg_lsn_ge(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_BOOL(lsn1 >= lsn2);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_lsn_larger(PG_FUNCTION_ARGS)
|
||||
{
|
||||
XLogRecPtr lsn1 = PG_GETARG_LSN(0);
|
||||
XLogRecPtr lsn2 = PG_GETARG_LSN(1);
|
||||
|
||||
PG_RETURN_LSN((lsn1 > lsn2) ? lsn1 : lsn2);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_lsn_smaller(PG_FUNCTION_ARGS)
|
||||
{
|
||||
XLogRecPtr lsn1 = PG_GETARG_LSN(0);
|
||||
XLogRecPtr lsn2 = PG_GETARG_LSN(1);
|
||||
|
||||
PG_RETURN_LSN((lsn1 < lsn2) ? lsn1 : lsn2);
|
||||
}
|
||||
|
||||
/* btree index opclass support */
|
||||
Datum
|
||||
pg_lsn_cmp(PG_FUNCTION_ARGS)
|
||||
|
||||
Reference in New Issue
Block a user