Re: bit type external representation

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: bit type external representation
Дата
Msg-id 3D3390F9.AA641270@fourpalms.org
обсуждение исходный текст
Ответ на Re: bit type external representation  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: bit type external representation
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] line datatype