| From: | "[Quipsy] Markus Karg" <karg(at)quipsy(dot)de> |
|---|---|
| To: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Cast INTEGER to BIT confusion |
| Date: | 2023-08-15 08:49:08 |
| Message-ID: | fbc716336d544e93b6af5e11af3e4aa0@quipsy.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hello PostgreSQL Community,
I have 25+ years of experience with some other RDBMS, but I am a PostgreSQL starter, so I assume the following is rather a simple beginner's question...:
I like to store just a single bit but that can be either 1 or 0, so I tried to do this:
CREATE TABLE T (c BIT);
INSERT INTO T VALUES (1);
-- I MUST NOT change both lines in any way as these are part of a third-party application!
Unfortunately this tells me:
column "c" is of type bit but expression is of type integer
So I logged in as a cluster admin and I tried this:
CREATE CAST (integer AS bit) WITH INOUT AS IMPLICIT;
Unfortunately that tells me:
cast from type integer to type bit already exists
This is confusing! Apparently PostgreSQL 15.3 comes with the needed cast out-of-the-box but it does not apply it? This is confusing!
What is my fault?
Thanks!
-Markus
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Olivier Gautherot | 2023-08-15 09:24:20 | Re: PostgreSQL and local HDD |
| Previous Message | Jason Long | 2023-08-15 07:23:42 | PostgreSQL and local HDD |