Re: SELECT d02name::bytea FROM ... && DBI::Pg

Поиск
Список
Период
Сортировка
Искать
От
Andrew Gierth
Тема
Re: SELECT d02name::bytea FROM ... && DBI::Pg
Дата
Msg-id
87zhi5vm0z.fsf@news-spur.riddles.org.uk
Ответ на
Список
Дерево обсуждения
SELECT d02name::bytea FROM ... && DBI::Pg Matthias Apitz <guru@unixarea.de>
Re: SELECT d02name::bytea FROM ... && DBI::Pg Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: SELECT d02name::bytea FROM ... && DBI::Pg Francisco Olarte <folarte@peoplecall.com>
Re: SELECT d02name::bytea FROM ... && DBI::Pg Matthias Apitz <guru@unixarea.de>
Re: SELECT d02name::bytea FROM ... && DBI::Pg Christoph Moench-Tegeder <cmt@burggraben.net>
Re: SELECT d02name::bytea FROM ... && DBI::Pg Francisco Olarte <folarte@peoplecall.com>
>>>>> "Matthias" == Matthias Apitz  writes:

 Matthias> Hello,

 Matthias> I can SELECT && print a column in hex with:

 Matthias> pos71=# select d02name::bytea from d02ben where d02bnr = '00001048313' ;

If your intention is to see the raw bytes of the stored text value, for
example to check the encoding, then you should not do it that way.
Casting from text to bytea does NOT do what you think.

Instead use  convert_to(d02name,'SQL_ASCII')  (yes, always specify
SQL_ASCII regardless of what encoding you think it should be in, since
the actual meaning of SQL_ASCII is "no conversions"). For readability,
you may then want to wrap that as
encode(convert_to(d02name,'SQL_ASCII'),'escape')  which will keep the
ASCII characters but use \nnn escapes for non-ascii.

-- 
Andrew (irc:RhodiumToad)


В списке pgsql-general по дате отправления
От: Andrew Gierth
Дата:
Сообщение: Re: day interval
От: Tom Lane
Дата:
Сообщение: Re: day interval
FAQ