pg_enable_utf8 and column names

Ch Lamprecht <[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
Hello,

the example below shows the following behaviour:
Given a table which has UTF8 chars in its column names, it seems, that these 
names (returned as keys by 'fetchrow_hashref')do not have the UTF8 flag set.
Is this behaviour expected?

Christoph

use warnings;
use strict;
use DBI;
require DBD::Pg;
require Devel::Peek;

print 'DBD::Pg::VERSION: ',$DBD::Pg::VERSION, "\n";

#database test:

#CREATE DATABASE test
#  WITH OWNER = postgres
#       ENCODING = 'UTF8'

my $dh= DBI -> connect(
               "DBI:Pg:dbname=test;host='127.0.0.1' ;port=5432",
               'postgres',
               '',
           );
$dh->do("SET client_encoding TO 'LATIN1'");

$dh->do ('DROP TABLE umlaute');
$dh->do ('CREATE TABLE umlaute ("ÀöÌ" varchar)');

$dh->do (q/INSERT INTO umlaute ("ÀöÌ") VALUES ( 'ÀöÌ' )/);

$dh->{pg_enable_utf8}=1;
$dh->do("SET client_encoding TO 'UTF8'");

my $sth = $dh->prepare('SELECT * FROM umlaute');
$sth->execute();
my ($name,$val)= %{$sth->fetchrow_hashref()};

Devel::Peek::Dump ($_) for ($name,$val);





perl 5.8.8
output:

DBD::Pg::VERSION: 1.49
SV = PVIV(0x227f14) at 0x1980704
   REFCNT = 2
   FLAGS = (PADBUSY,PADMY,POK,pPOK)
   IV = 0
   PV = 0x1acc4d4 "\303\244\303\266\303\274"\0
   CUR = 6
   LEN = 8
SV = PV(0x1aae210) at 0x19806ec
   REFCNT = 2
   FLAGS = (PADBUSY,PADMY,POK,pPOK,UTF8)
   PV = 0x1acc4f4 "\303\244\303\266\303\274"\0 [UTF8 "\x{e4}\x{f6}\x{fc}"]
   CUR = 6
   LEN = 8
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.