Re: to_hex() for negative inputs

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: to_hex() for negative inputs
Date: 2023-01-25 21:43:30
Message-ID: ac4df0fb-5b57-4c18-30c1-c24d42e562b6@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24.01.23 14:10, Dean Rasheed wrote:
> I also think it might be useful for it to gain a couple of boolean options:
>
> 1). An option to output a signed value (defaulting to false, to
> preserve the current two's complement output).

I find the existing behavior so strange, I would rather give up and
invent a whole new function family with correct behavior, which could
then also support octal and binary, and perhaps any base. This could be
something generally named, like "convert" or "format".

> 2). An option to output the base prefix "0x" (which comes after the
> sign, making it inconvenient for the user to add themselves).

This could also be handled with a "format"-like function.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-01-25 21:50:22 Re: pgsql: Rename contrib module basic_archive to basic_wal_module
Previous Message Nathan Bossart 2023-01-25 21:34:51 Re: pgsql: Rename contrib module basic_archive to basic_wal_module