From: | Thomas Lockhart <lockhart(at)fourpalms(dot)org> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | PostgreSQL Hackers List <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: bit type external representation |
Date: | 2002-07-16 03:20:25 |
Message-ID: | 3D3390F9.AA641270@fourpalms.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > 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=# insert into test values (B'101');
> test=# insert into test values ('B101');
Right. But internally the first example has the "B" stripped out, and
the bit string input routine assumes a binary bit string if there is no
embedded leading [bBxX]. However, if we were to just pass something
without a [xX] as an explicit prefix on the string then it will always
be interpreted as a binary bit string (remember that currently X'ABCD'
is converted to decimal, not to a bit string).
> In fact, some of our apps actually _rely_ on the old 'b101' syntax...
> Although these could be changed with some effort...
Yes, it seems that applications reading from something like libpq would
need to detect that this is a bit string and then figure out how to
represent it on input or output.
"Cheating" with a leading "B" or "X" helps with this a lot. Note that
simply a leading "B" is not sufficient to distinguish between a binary
value and some hex values, if we were to allow output in hex...
- Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-07-16 03:33:48 | Re: line datatype |
Previous Message | Christopher Kings-Lynne | 2002-07-16 03:12:21 | Re: bit type external representation |