Re: Introduce MIN/MAX aggregate functions to pg_lsn
Surafel Temsgen <surafel3000@gmail.com>
From: Surafel Temesgen <surafel3000@gmail.com>
To: fabriziomello@gmail.com
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2019-07-02T10:22:32Z
Lists: pgsql-hackers
Hi,
Here are same review comment
- <entry>any numeric, string, date/time, network, or enum type,
+ <entry>any numeric, string, date/time, network, lsn, or enum type,
or arrays of these types</entry>
<entry>same as argument type</entry>
In the documentation it refereed as pg_lsn type rather than lsn alone
+Datum
+pg_lsn_larger(PG_FUNCTION_ARGS)
+{
+ XLogRecPtr lsn1 = PG_GETARG_LSN(0);
+ XLogRecPtr lsn2 = PG_GETARG_LSN(1);
+ XLogRecPtr result;
+
+ result = ((lsn1 > lsn2) ? lsn1 : lsn2);
+
+ PG_RETURN_LSN(result);
+}
rather than using additional variable its more readable and effective to
return the argument
itself like we do in date data type and other place
regards
Surafel
Commits
-
Add min() and max() aggregates for pg_lsn
- 313f87a17155 13.0 landed