Re: Cast INTEGER to BIT confusion

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Cast INTEGER to BIT confusion
Дата
Msg-id CAKFQuwZSzYDpPjPAHonewfRBHgjY5MBT0txdTtF2PHg4KoSKpQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Cast INTEGER to BIT confusion  (Erik Wienhold <ewie@ewie.name>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: AW: AW: Cast INTEGER to BIT confusion
Следующее
От: Erik Wienhold
Дата:
Сообщение: Re: AW: AW: Cast INTEGER to BIT confusion