Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux