Re: bit type external representation - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: bit type external representation
Date
Msg-id GNELIHDDFBOCMGBFGEFOOECJCDAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to bit type external representation  (Thomas Lockhart <lockhart@fourpalms.org>)
List pgsql-hackers
> for binary and hexadecimal representations. But at the moment we don't
> explicitly handle both of these cases as bit strings; the hex version is
> converted to decimal in the scanner (*really* early in the parsing
> stage) and then handled as an integer.
>
> It looks like our current bit string type support looks for a "B" or "X"
> embedded in the actual input string, rather than outside the quote as in
> the standard.

Postgres supports both:

test=# create table test (a bit(3));
CREATE
test=# insert into test values (B'101');
INSERT 3431020 1
test=# insert into test values (b'101');
INSERT 3431021 1
test=# insert into test values ('B101');
INSERT 3431022 1
test=# insert into test values ('b101');
INSERT 3431023 1
test=# select * from test; a
-----101101101101
(4 rows)

In fact, some of our apps actually _rely_ on the old 'b101' syntax...
Although these could be changed with some effort...

Chris



pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: bit type external representation
Next
From: Thomas Lockhart
Date:
Subject: Re: bit type external representation