Re: [PATCH] Add function to_oct

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Kirk Wolak <wolakk(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Eric Radman <ericshane(at)eradman(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Add function to_oct
Date: 2023-08-19 07:35:46
Message-ID: CAEZATCWaQ+-7A9AxxUcxdhdOa4p54rSvKreHMXhnTJg6VuAURQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 17 Aug 2023 at 16:26, Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> Works for me. I did it that way in v7.
>

I note that there are no tests for negative inputs.

Doing a quick test, shows that this changes the current behaviour,
because all inputs are now treated as 64-bit:

HEAD:

select to_hex((-1234)::int);
to_hex
----------
fffffb2e

With patch:

select to_hex((-1234)::int);
to_hex
------------------
fffffffffffffb2e

The way that negative inputs are handled really should be documented,
or at least it should include a couple of examples.

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-08-19 09:35:01 Re: WIP: new system catalog pg_wait_event
Previous Message Julien Rouhaud 2023-08-19 07:16:15 Re: persist logical slots to disk during shutdown checkpoint