Re: Weird 'bit' type behaviour

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Weird 'bit' type behaviour
Date: 2004-06-14 13:19:50
Message-ID: 28698.1087219190@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> Is there any reason for this behaviour:
> test=# select 1::bit;
> bit
> -----
> 0
> (1 row)

This is actually "1::int4::bit(1)", and what you are getting is
the sign bit. See previous discussions about int-to-bit conversion
and which part of the int we ought to take.

> What about these?

Again, it's a field-width issue. These all default to bit(1) and
you're shifting out of the defined width.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gaetano Mendola 2004-06-14 13:33:29 Re: File leak?
Previous Message Tom Lane 2004-06-14 13:15:02 Re: Delaying the planning of unnamed statements until Bind