Re: bit strings - anyone working on them?

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bit strings - anyone working on them?
Date: 2003-04-23 14:50:44
Message-ID: 5.1.0.14.0.20030424004359.058a7c18@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 10:36 AM 23/04/2003 -0400, Tom Lane wrote:

> > Cast(8 as bit(10)) => '0001000000'
> > Cast(8 as bit(4)) => '0001'
>
>That part we could do, I think, if you are willing to abandon the
>assumption that the result of casting int to bit(n) and then to bit(m)
>should agree with the result of casting int directly to bit(m).

I'm not sure I follow the implication; in fact I would hope that:

Cast(B'0001' as bit(10))

would yield '0001000000'.

> > B'1' # Cast(1 as bit(32)) => '00000000000000000000000000000000'
>
>Eh? What is the # operator supposed to be doing here?

It's the XOR operator. Current implementation has:

Cast(B'1' as bit(32)) XOR Cast(1 as bit(32))
giving
10000000000000000000000000000001

Another thing I have forgotten to mention is that there are no
text<->varbit conversions.

>Perhaps these
>operators should only exist for varbit, or should demand inputs already
>the same length for bit.

That seems like a good idea. I'd prefer to make these changes for varbit only.

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 03 5330 3172 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message scott.marlowe 2003-04-23 15:27:04 Re: Are we losing momentum?
Previous Message Tom Lane 2003-04-23 14:36:24 Re: bit strings - anyone working on them?