Mailing List Archive

[interchange] Fix non-deterministic UTF8 handling with PostgreSQL database
commit 459ffdbff195c171069ba9b653e14cd48d1924eb
Author: David Christensen <david@endpoint.com>
Date: Tue Nov 14 14:41:09 2017 -0600

Fix non-deterministic UTF8 handling with PostgreSQL database

If using PostgreSQL and versions of DBD::Pg >= 3, code will behave differently if no value is set in
config for DatabaseDefault PG_ENABLE_UTF8. This would affect installations which were even opting
out of all UTF-8 support in Interchange by using the MINIVEND_DISABLE_UTF8 environment variable.

This happened because the default UTF-8 handling for DBD::Pg as of 3.0 turned into automatically
decoding UTF-8 data as perl scalarsm so catalogs/stacks which were now using a new version of
DBD::Pg could run into unexpected behavior (at the very least, increased parsing time due to using
unicode-aware regexes under-the-hook).

Specify the default to be off to match the existing state before this module; in all cases, you have
to opt in to UTF-8 specific IC, so no reason to change this here.

Reviewed-by: Mark Johnson <mark@endpoint.com>

lib/Vend/Config.pm | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/lib/Vend/Config.pm b/lib/Vend/Config.pm
index 69bdd8c..66b92a5 100644
--- a/lib/Vend/Config.pm
+++ b/lib/Vend/Config.pm
@@ -4526,6 +4526,8 @@ sub parse_database {
else { $d->{Class} ||= $Global::Default_database }

if($C and $C->{DatabaseDefault}) {
+ $C->{DatabaseDefault}{PG_ENABLE_UTF8} = 0
+ unless defined $C->{DatabaseDefault}{PG_ENABLE_UTF8};
while ( my($k, $v) = each %{$C->{DatabaseDefault}}) {
$d->{$k} = $v;
}

_______________________________________________
interchange-cvs mailing list
interchange-cvs@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-cvs