Re: [GENERAL] Shouldn't B'1' = 1::bit be true?

From: "Thomas Swan" <tswan(at)idigx(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: tswan(at)idigx(dot)com, "Bill Moran" <wmoran(at)potentialtech(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] Shouldn't B'1' = 1::bit be true?
Date: 2004-03-10 23:18:55
Message-ID: 48135.199.222.14.2.1078960735.squirrel@www.idigx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

<quote who="Tom Lane">
> "Thomas Swan" <tswan(at)idigx(dot)com> writes:
>> To convert low bits ot high bits you pad 0 bits on the left. To
>> convert
>> from high to low you strip bits off the left hand side. This allows
>> reasonable behavior.
>
> Unfortunately, the SQL spec is perfectly clear that you pad or strip
> zero bits on the *right* of the bit string. We cannot change that.
>

I was completely unaware of that fact. *must dig a deeper hole*

> It might have been better if we had defined int<->bit casts to treat
> the first bit of the bit string as the LSB of the integer. But we
> didn't, and it's probably too big a change to consider.
>

It would be a big change at least in the 7.x series. Maybe the change
could be tabled to an 8.x release.

Thomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Hachmann 2004-03-10 23:30:11 Mails not taken by List
Previous Message Bruno Wolff III 2004-03-10 23:18:40 Re: returning row numbers in select

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan Gardner 2004-03-10 23:27:26 Re: How to get RelationName ??
Previous Message Tom Lane 2004-03-10 23:04:51 Re: selective statement logging