summaryrefslogtreecommitdiff
path: root/src/pl/plperl/plperl_helpers.h
AgeCommit message (Collapse)Author
2015-09-29Fix plperl to handle non-ASCII error message texts correctly.Tom Lane
We were passing error message texts to croak() verbatim, which turns out not to work if the text contains non-ASCII characters; Perl mangles their encoding, as reported in bug #13638 from Michal Leinweber. To fix, convert the text into a UTF8-encoded SV first. It's hard to test this without risking failures in different database encodings; but we can follow the lead of plpython, which is already assuming that no-break space (U+00A0) has an equivalent in all encodings we care about running the regression tests in (cf commit 2dfa15de5). Back-patch to 9.1. The code is quite different in 9.0, and anyway it seems too risky to put something like this into 9.0's final minor release. Alex Hunsaker, with suggestions from Tim Bunce and Tom Lane
2015-04-26Add transforms featurePeter Eisentraut
This provides a mechanism for specifying conversions between SQL data types and procedural languages. As examples, there are transforms for hstore and ltree for PL/Perl and PL/Python. reviews by Pavel Stěhule and Andres Freund
2014-02-23Prefer pg_any_to_server/pg_server_to_any over pg_do_encoding_conversion.Tom Lane
A large majority of the callers of pg_do_encoding_conversion were specifying the database encoding as either source or target of the conversion, meaning that we can use the less general functions pg_any_to_server/pg_server_to_any instead. The main advantage of using the latter functions is that they can make use of a cached conversion-function lookup in the common case that the other encoding is the current client_encoding. It's notationally cleaner too in most cases, not least because of the historical artifact that the latter functions use "char *" rather than "unsigned char *" in their APIs. Note that pg_any_to_server will apply an encoding verification step in some cases where pg_do_encoding_conversion would have just done nothing. This seems to me to be a good idea at most of these call sites, though it partially negates the performance benefit. Per discussion of bug #9210.
2013-05-29pgindent run for release 9.3Bruce Momjian
This is the first run of the Perl-based pgindent script. Also update pgindent instructions.
2012-07-10plperl: Skip setting UTF8 flag when in SQL_ASCII encodingAlvaro Herrera
When in SQL_ASCII encoding, strings passed around are not necessarily UTF8-safe. We had already fixed this in some places, but it looks like we missed some. I had to backpatch Peter Eisentraut's a8b92b60 to 9.1 in order for this patch to cherry-pick more cleanly. Patch from Alex Hunsaker, tweaked by Kyotaro HORIGUCHI and myself. Some desultory cleanup and comment addition by me, during patch review. Per bug report from Christoph Berg in 20120209102116.GA14429@msgid.df7cb.de
2012-06-10Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian
commit-fest.
2012-05-27PL/Perl: Avoid compiler warning from clangPeter Eisentraut
Use SvREFCNT_inc_simple_void() instead of SvREFCNT_inc() to avoid warning about unused return value.
2012-05-08Fix misleading commentsPeter Eisentraut
Josh Kupershmidt
2012-01-15Improve efficiency of recent changes to plperl's sv2cstr().Andrew Dunstan
Along the way, add a missing dependency in the GNUmakefile. Alex Hunsaker, with a slight adjustment by me.
2012-01-05Fix breakage from earlier plperl fix.Andrew Dunstan
Apparently the perl garbage collector was a bit too eager, so here we control when the new SV is garbage collected.
2012-01-05Work around perl bug in SvPVutf8().Andrew Dunstan
Certain things like typeglobs or readonly things like $^V cause perl's SvPVutf8() to die nastily and crash the backend. To avoid that bug we make a copy of the object, which will subsequently be garbage collected. Back patched to 9.1 where we first started using SvPVutf8(). Per -hackers discussion. Original problem reported by David Wheeler.
2011-11-26Ensure plperl strings are always correctly UTF8 encoded.Andrew Dunstan
Amit Khandekar and Alex Hunsaker. Backpatched to 9.1 where the problem first occurred.
2011-04-10pgindent run before PG 9.1 beta 1.Bruce Momjian
2011-02-06Force strings passed to and from plperl to be in UTF8 encoding.Andrew Dunstan
String are converted to UTF8 on the way into perl and to the database encoding on the way back. This avoids a number of observed anomalies, and ensures Perl a consistent view of the world. Some minor code cleanups are also accomplished. Alex Hunsaker, reviewed by Andy Colson.