Re: BUG #5010: perl iconv function returns ? character - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5010: perl iconv function returns ? character
Date
Msg-id 25035.1252255110@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #5010: perl iconv function returns ? character  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: BUG #5010: perl iconv function returns ? character  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Aug 25, 2009 at 8:15 AM, Lampa<lampacz@gmail.com> wrote:
>> function my_ascii2 is defined:
>> CREATE FUNCTION my_ascii2(text) RETURNS text AS $$ use strict; use
>> Text::Iconv; my $conv = Text::Iconv->new("UTF8", "ASCII//TRANSLIT"); return
>> $conv->convert($_[0]); $$ LANGUAGE plperlu;
>>
>> 8.3.x version works perfectly, 8.4.0 problem

> I can't reproduce this on 8.4.0 or CVS HEAD.  I think that whatever
> problem you have here is not a PostgreSQL bug.

Hmm ... I can reproduce the problem on Fedora 11.  Given a UTF8-encoded
database (I don't think locale matters), 8.3.7 works as described, but
8.3.8 fails as described, as do 8.4.1 and HEAD.  Given that the only
difference in plperl.c between 8.3.7 and 8.3.8 is the addition of the
PERL_SYS_INIT3 call, I have to suppose that that's screwing up
Text::Iconv somehow.

I'd bet a small amount of money that this is somehow related to the
UTF8-specific code in plperl_safe_init(), which always struck me
as unexplained hocus-pocus.  Since the test function is plperlu,
plperl_safe_init() obviously can't be directly to blame; but I'm
thinking that what it's really doing is papering over some missed
initialization issue that affects plperlu functions too.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Robert Haas
Date:
Subject: Re: BUG #5034: plperlu problem with gethostbyname
Next
From: Tom Lane
Date:
Subject: Re: BUG #5010: perl iconv function returns ? character