Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding. - Mailing list pgsql-hackers

From Alex Hunsaker
Subject Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.
Date
Msg-id CAFaPBrTRG2+4rA+QowWWx0dHrhXNBG0eoP+dhEKS19-yTJ9i2Q@mail.gmail.com
Whole thread Raw
In response to Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.  (Amit Khandekar <amit.khandekar@enterprisedb.com>)
Responses Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.
List pgsql-hackers
On Mon, Oct 3, 2011 at 04:20, Amit Khandekar
<amit.khandekar@enterprisedb.com> wrote:

> Is there a plan to commit this issue? I am still seeing this issue on
> PG 9.1 STABLE branch. Attached is a small patch that targets only the
> specific issue in the described testcase :
>
> create or replace function zerob() returns text as $$ return
> "abcd\0efg"; $$ language plperl;
> SELECT zerob();
>
> The patch does the perl data validation in the function utf_u2e() itself.

I think thats fine, but as coded it will verify the string twice in
the GetDatabaseEncoding() != PG_UTF8 case (once for
pg_do_encoding_conversion() and again with the added
pg_verify_mbstr_len), which seems a bit wasteful.

It might be worth adding a regression test also...


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug with pg_ctl -w/wait and config-only directories
Next
From: Peter Eisentraut
Date:
Subject: Re: Bug with pg_ctl -w/wait and config-only directories