bit type external representation

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: PostgreSQL Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: bit type external representation
Date: 2002-07-16 03:04:02
Message-ID: 3D338D22.1C4FBDE4@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2002-07-16 03:08:53 Re: bit type external representation
Previous Message Thomas Lockhart 2002-07-16 01:46:16 Re: pgsql/ onfig/docbook.m4 oc/src/sgml/features.sgml