SELECT d02name::bytea FROM ... && DBI::Pg
| От | Matthias Apitz |
|---|---|
| Тема | SELECT d02name::bytea FROM ... && DBI::Pg |
| Дата | |
| Msg-id | 20191010112458.GA271079@sh4-5.1blu.de обсуждение |
| Ответы |
Re: SELECT d02name::bytea FROM ... && DBI::Pg
Re: SELECT d02name::bytea FROM ... && DBI::Pg |
| Список | pgsql-general |
Hello,
I can SELECT && print a column in hex with:
pos71=# select d02name::bytea from d02ben where d02bnr = '00001048313' ;
...
\x50c3a46461676f67697363686520486f6368736368756c65205765696e67617274656e2020 ...
but when I use the same in Perl DBI::Pg with:
...
$sth=$dbh->prepare( "select d02name::bytea from d02ben where d02bnr = '00001048313'");
$sth->execute or die "exec error\n".${DBI::errstr}."\n";
while ( (@row = $sth->fetchrow_array) ) {
print "$row[0]\n";
}
It prints the UTF-8 string and not the hex string:
./utf8-01.pl
DBI is version 1.642, DBD::Pg is version 3.8.0
client_encoding=UTF8, server_encoding=UTF8
Pädagogische Hochschule Weingarten
I checked with strace that the PG server delivers to DBI:Pg the
hex string, so it must be converted somewhere (or in print ...) again to
UTF-8. See below.
Any ideas?
matthias
recvfrom(3, "T\0\0\0
\0\1d02name\0\0\0\0\0\0\0\0\0\0\21\377\377\377\377\377\377\0\0D\0\0\0\376\0\1\0\0\0\364\\x50c3a46461676f67697363686520486f6368736368756c65205765696e67617274656e2020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020C\0\0\0\rSELECT
1\0Z\0\0\0\5I", 16384, 0, NULL, NULL) = 308
write(1, "P\303\244dagogische Hochschule Weingarten
--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!
В списке pgsql-general по дате отправления: