Re: Introduce MIN/MAX aggregate functions to pg_lsn

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Surafel Temesgen <surafel3000(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Introduce MIN/MAX aggregate functions to pg_lsn
Date: 2019-07-02 14:31:49
Message-ID: CAFcNs+qC_Up88uvA9sS2F+KEjvMk0+oWoLRSP4gphhHwJk58zA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 2, 2019 at 7:22 AM Surafel Temesgen <surafel3000(at)gmail(dot)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

Attachment Content-Type Size
add_min_max_aggregates_for_pg_lsn_type_v2.patch text/x-patch 5.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anthony Nowocien 2019-07-02 14:43:20 Re: progress report for ANALYZE
Previous Message Adam Berlin 2019-07-02 14:10:51 Re: C testing for Postgres