Re: [BUGS] BUG #2683: spi_exec_query in plperl returns - Mailing list pgsql-hackers

From David Fetter
Subject Re: [BUGS] BUG #2683: spi_exec_query in plperl returns
Date
Msg-id 20061015221631.GB7037@fetter.org
Whole thread Raw
In response to Re: [BUGS] BUG #2683: spi_exec_query in plperl returns  ("Andrew Dunstan" <andrew@dunslane.net>)
List pgsql-hackers
On Sun, Oct 15, 2006 at 04:50:15PM -0500, Andrew Dunstan wrote:
> Tom Lane wrote:
> > I wrote:
> >> It looks to me like basically everywhere in plperl.c that does
> >> newSVpv() should follow it with
> >>
> >> #if PERL_BCDVERSION >= 0x5006000L
> >>             if (GetDatabaseEncoding() == PG_UTF8)
> >>                 SvUTF8_on(sv);
> >> #endif
> >
> > Experimentation proved that this was insufficient to fix Vitali's
> > problem --- the string he's unhappy about is actually a hash key
> > entry, and there's no documented way to mark the second argument
> > of hv_store() as being a UTF-8 string.  Some digging in the Perl
> > source code found that since at least Perl 5.8.0, hv_fetch and
> > hv_store recognize a negative key length as meaning a UTF-8 key
> > (ick!!), so I used that hack.  I am not sure there is any
> > reasonable fix available in Perl 5.6.x.
> >
> > Attached patch applied to HEAD, but I'm not going to risk
> > back-patching it without some field testing.
> 
> Hmm. That negative pointer hack is mighty ugly.
> 
> I am also wondering, now that it's been raised, if we need to issue
> a "use utf8;" in the startup code, so that literals in the code get
> the right encoding.

That would be a reason to go to 5.8, as 'use utf8;' is tricky at best
in 5.6.

Cheers,
D
-- 
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #2683: spi_exec_query in plperl returns
Next
From: Tom Lane
Date:
Subject: Re: Threaded python on FreeBSD