Re: right() returns the whole string for the most negative n

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: right() returns the whole string for the most negative n
Date: 2026-08-25 12:33:30
Message-ID: F58E7A4E-0029-4C18-A874-710CF456E680@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 25 Aug 2026, at 14:18, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> wrote:
>
> Instead of open-coding this, how about about using pg_neg_s32_overflow?
>
> if (pg_neg_s32_overflow(n, &n))
> n = PG_INT32_MAX;

Yes, that's indeed a good idea.

--
Daniel Gustafsson

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sagar Shedge 2026-08-25 12:48:00 [PATCH v1] Report specific wait events for libpq cancel requests
Previous Message Sehrope Sarkuni 2026-08-25 12:27:54 Re: Replace px_memset() with explicit_bzero()