Shouldn't B'1' = 1::bit be true?

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Shouldn't B'1' = 1::bit be true?
Date: 2004-03-03 21:42:34
Message-ID: 4046514A.5010809@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Am I missing something here?

agelis=# select B'1'::int;
int4
------
1
(1 row)

agelis=# select 1::bit;
bit
-----
0
(1 row)

agelis=# select B'1'=1;
?column?
----------
f
(1 row)

Last I checked, binary 1 and integer 1 were equal. Is this a bug, or is there
a reason for this that I need educated on? Why does int 1 cast to binary 0?

This is Posgres 7.4.1.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2004-03-03 21:57:28 Slony-I makes progress
Previous Message Bruce Momjian 2004-03-03 19:40:15 Re: libpq API for PQcmdTuples()

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2004-03-03 21:52:06 Re: Out of space situation and WAL log pre-allocation (was
Previous Message Simon Riggs 2004-03-03 21:40:09 Re: Out of space situation and WAL log pre-allocation (was Tablespaces)