Re: pl/perl and utf-8 in sql_ascii databases - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pl/perl and utf-8 in sql_ascii databases
Date
Msg-id 1340219416-sup-3443@alvh.no-ip.org
Whole thread Raw
In response to Re: pl/perl and utf-8 in sql_ascii databases  (Alex Hunsaker <badalex@gmail.com>)
Responses Re: pl/perl and utf-8 in sql_ascii databases
Re: pl/perl and utf-8 in sql_ascii databases
List pgsql-hackers
Excerpts from Alex Hunsaker's message of vie feb 10 16:53:05 -0300 2012:

> Seems like we missed the fact that we still did SvUTF8_on() in sv2cstr
> and SvPVUTF8() when turning a perl string into a cstring.

Right.

So I played a bit with this patch, and touched it a bit mainly just to
add some more comments; and while at it I noticed that some of the
functions in Util.xs might leak some memory, so I made an attempt to
plug them, as in the attached patch (which supersedes yours).

Now, with my version of the patch applied and using a SQL_ASCII database
to test the problem in the original report, I notice that we now have a
regression failure:

*** /pgsql/source/HEAD/src/pl/plperl/expected/plperl.out        2012-05-16 13:38:02.495647259 -0400
--- /home/alvherre/Code/pgsql/build/HEAD/src/pl/plperl/results/plperl.out       2012-06-20 15:09:19.869778824 -0400
***************
*** 658,664 ****
    return "abcd\0efg";
  $$ LANGUAGE plperl;
  SELECT perl_zerob();
! ERROR:  invalid byte sequence for encoding "UTF8": 0x00
  CONTEXT:  PL/Perl function "perl_zerob"
  -- make sure functions marked as VOID without an explicit return work
  CREATE OR REPLACE FUNCTION myfuncs() RETURNS void AS $$
--- 658,664 ----
    return "abcd\0efg";
  $$ LANGUAGE plperl;
  SELECT perl_zerob();
! ERROR:  invalid byte sequence for encoding "SQL_ASCII": 0x00
  CONTEXT:  PL/Perl function "perl_zerob"
  -- make sure functions marked as VOID without an explicit return work
  CREATE OR REPLACE FUNCTION myfuncs() RETURNS void AS $$

======================================================================


I'm not really sure what to do here -- maybe have a second expected file
for that test is a good enough answer?  Or should I just take the test
out?  Opinions please.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node
Next
From: Andres Freund
Date:
Subject: Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node