Re: Introduce MIN/MAX aggregate functions to pg_lsn

Fabrízio de Royes Mello <fabriziomello@gmail.com>

From: Fabrízio de Royes Mello <fabriziomello@gmail.com>
To: Surafel Temesgen <surafel3000@gmail.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2019-07-02T14:31:49Z
Lists: pgsql-hackers

Attachments

On Tue, Jul 2, 2019 at 7:22 AM Surafel Temesgen <surafel3000@gmail.com>
wrote:
>
> Hi,
> Here are same review comment

Thanks for your review.

> -      <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

Fixed.

> +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
>

Fixed.

New version attached.

Regards,

--
   Fabrízio de Royes Mello         Timbira - http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

Commits

  1. Add min() and max() aggregates for pg_lsn