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

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

"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.

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.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Wolfe 2004-03-10 19:19:18 Re: load testing
Previous Message Thomas Swan 2004-03-10 18:45:13 Re: [GENERAL] Shouldn't B'1' = 1::bit be true?

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2004-03-10 19:06:38 Re: Timing of 'SELECT 1'
Previous Message Marcelo Carvalho Fernandes 2004-03-10 18:59:24 PANIC on start