Permalink
Browse files

client_encoding in conninfo is not supported by libpq 8.x.x

  • Loading branch information...
1 parent 82acbc8 commit 4982813b444270bee5b9c79cfbc5be8eda4774d9 root committed May 10, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/Pg/PQ.pm
View
@@ -30,13 +30,16 @@ sub _make_conninfo {
if (@_ == 1 and ref $_[0] eq 'HASH') {
%opts = %{$_[0]}
}
- elsif (@_ & 1) {
- $conninfo[0] = shift @_;
- $conninfo[0] = "dbname=$conninfo[0]" unless $conninfo[0] =~ /=/;
+ else {
+ if (@_ & 1) {
+ $conninfo[0] = shift @_;
+ $conninfo[0] = "dbname=$conninfo[0]" unless $conninfo[0] =~ /=/;
+ }
%opts = @_;
}
push @conninfo, map _escape_opt($_).'='._escape_opt($opts{$_}), keys %opts;
- push @conninfo, 'client_encoding=UTF8';
+ no warnings 'numeric';
+ push @conninfo, 'client_encoding=UTF8' if Pg::PQ::libVersion() >= 9;
# warn "conninfo: >@conninfo<\n";
join ' ', @conninfo;
}

0 comments on commit 4982813

Please sign in to comment.