Re: Cast INTEGER to BIT confusion

2023-08-17 Thread David G. Johnston
On Tuesday, August 15, 2023, Erik Wienhold wrote: > > On 15/08/2023 10:49 CEST [Quipsy] Markus Karg 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 v

Re: Cast INTEGER to BIT confusion

2023-08-17 Thread Erik Wienhold
> On 17/08/2023 14:57 CEST rob stone wrote: > > It works thus:- > > postgres 15.4 =# CREATE TABLE T (c BIT); > CREATE TABLE > postgres 15.4 =# insert into T values (B'1'); > INSERT 0 1 > postgres 15.4 =# select * from t; > c > --- > 1 > (1 row) > > See section 9.6 in the doco. But Markus wrote

Re: Cast INTEGER to BIT confusion

2023-08-17 Thread rob stone
Hello, On Tue, 2023-08-15 at 08:49 +, [Quipsy] Markus Karg wrote: > > > > 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 jus

Re: Cast INTEGER to BIT confusion

2023-08-15 Thread Greg Sabino Mullane
On Tue, Aug 15, 2023 at 4:49 AM [Quipsy] Markus Karg wrote: > > 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! > That is quite the requirement! I hope that the rest of the application is more

Re: Cast INTEGER to BIT confusion

2023-08-15 Thread Erik Wienhold
> On 15/08/2023 10:49 CEST [Quipsy] Markus Karg wrote: > > Hello PostgreSQL Community, > > 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 par