Skip to content

Commit

Permalink
Fix non-deterministic UTF8 handling with PostgreSQL database
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Christensen committed Nov 14, 2017
1 parent b6ebec3 commit 459ffdb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Vend/Config.pm
Expand Up @@ -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;
}
Expand Down

0 comments on commit 459ffdb

Please sign in to comment.