Re: Support for unsigned integer types

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Jack Bay <jack(dot)victor(dot)bay(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Support for unsigned integer types
Date: 2024-12-10 15:25:12
Message-ID: e3d0d43d-99d7-4412-afad-f16831f3065e@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06.12.24 19:45, Jack Bay wrote:
> Unsigned integers are a widely used type and can be important for
> compact and well-aligned data structures, but are not currently
> available in PostgreSQL.
>
> In particular unsigned 64-bit integers and unsigned 32-bit integers
> are desirable as identifiers. They unambiguously correspond to
> specific hexadecimal or other human-readable encoded representations.
> Although signed integers can be used for this purpose, there is the
> potential for human error in confusing a positive value for a negative
> value, corner cases around maximum and minimum values (which are
> statistically certain to be encountered when random bits are used for
> the integer), the potential for human error in interconverting hex and
> other encoded representations, text representation nonuniformity (the
> need for a space for the minus sign), and a variety of associated
> nuisances.
>
> Would it be possible to add support for unsigned 64-bit and unsigned
> 32-bit integers to postgresql?

Here is an extension that implements this: https://github.com/petere/pguint

You can use this for production use and perhaps also as the basis for
experimentation about different behaviors and trade-off that have been
mentioned.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-12-10 16:09:41 Re: FileFallocate misbehaving on XFS
Previous Message Pavel Borisov 2024-12-10 15:22:29 Re: [PATCH] Support Int64 GUCs