Re: [HACKERS] Weird 'bit' type behaviour

2004-06-14 Thread Tom Lane
Christopher Kings-Lynne [EMAIL PROTECTED] 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

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[HACKERS] Weird 'bit' type behaviour

2004-06-13 Thread Christopher Kings-Lynne
Is there any reason for this behaviour:
test=# select 1::bit;
 bit
-
 0
(1 row)
test=# select '1'::bit;
 bit
-
 1
(1 row)
Chris
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly