bit type external representation - Mailing list pgsql-hackers

From Thomas Lockhart
Subject bit type external representation
Date
Msg-id 3D338D22.1C4FBDE4@fourpalms.org
Whole thread Raw
Responses Re: bit type external representation  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Re: bit type external representation  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
SQL9x defines bit string constants with a format like
 B'101010'
and X'ABCD'

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.

I'd like to have more support for the SQL9x syntax, which requires a
little more invasive modification of at least the scanner and parser. I
have a couple of questions:

1) the SQL standard says what hex values should be translated to in
binary, which implies that all values may be *output* in binary format.
Should we do this, or should we preserve the info on what units were
used for input in the internal storage? Anyone interpret the standard
differently from this??

2) we would need to be able to determine the format style when a string
is output to be able to reconstruct the SQL shorthand representation (if
preserving binary or hex is to be done). So a column or value should
have a corresponding is_hex() function call. Any other suggestions??
                   - Thomas


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [COMMITTERS] pgsql/ onfig/docbook.m4 oc/src/sgml/features.sgml
Next
From: Thomas Lockhart
Date:
Subject: Re: bit type external representation