Re: Cast INTEGER to BIT confusion - Mailing list pgsql-general

From David G. Johnston
Subject Re: Cast INTEGER to BIT confusion
Date
Msg-id CAKFQuwZSzYDpPjPAHonewfRBHgjY5MBT0txdTtF2PHg4KoSKpQ@mail.gmail.com
Whole thread Raw
In response to Re: Cast INTEGER to BIT confusion  (Erik Wienhold <ewie@ewie.name>)
List pgsql-general
On Tuesday, August 15, 2023, Erik Wienhold <ewie@ewie.name> wrote:
> On 15/08/2023 10:49 CEST [Quipsy] Markus Karg <karg@quipsy.de> wrote:
>
> Hello PostgreSQL Community,
>
> I like to store just a single bit but that can be either 1 or 0, so I tried

You could create a custom domain if you're only interested in values 0 and 1
and don't use bit string functions.  The search path must be changed so that
domain bit overrides pg_catalog.bit:

The table using the system bit type already exists and thus the oid for the data type of the stored catalog column is that of the system bit type.  Creating a user bit domaim is going to have absolutely zero impact on this situation.
 
If you really want to make this work and are willing to risk and deal with side-effects of manual catalog updates you could maybe make the existing cast implicit.

David J.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: AW: AW: Cast INTEGER to BIT confusion
Next
From: Erik Wienhold
Date:
Subject: Re: AW: AW: Cast INTEGER to BIT confusion