Re: Support for unsigned integer types - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Support for unsigned integer types
Date
Msg-id e3d0d43d-99d7-4412-afad-f16831f3065e@eisentraut.org
Whole thread Raw
In response to Support for unsigned integer types  (Jack Bay <jack.victor.bay@gmail.com>)
List 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.




pgsql-hackers by date:

Previous
From: Pavel Borisov
Date:
Subject: Re: [PATCH] Support Int64 GUCs
Next
From: Andres Freund
Date:
Subject: Re: FileFallocate misbehaving on XFS