]> granicus.if.org Git - pgbadger/commitdiff
Enable allow_loose_quotes and undef escape_char in Text::CSV_XS call to fix CSV forma...
authorDarold Gilles <gilles@darold.net>
Tue, 30 Sep 2014 19:04:30 +0000 (21:04 +0200)
committerDarold Gilles <gilles@darold.net>
Tue, 30 Sep 2014 19:04:30 +0000 (21:04 +0200)
pgbadger

index fc2d7ae296624277f99751f80e78847997c9cf88..6c359087cbc111d87135621116f696941fff0a15 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -1932,7 +1932,15 @@ sub process_file
        if ($format eq 'csv') {
 
                require Text::CSV_XS;
-               my $csv = Text::CSV_XS->new({binary => 1, eol => $/, sep_char => $csv_sep_char});
+               my $csv = Text::CSV_XS->new(
+                       {
+                               binary => 1,
+                               eol => $/,
+                               sep_char => $csv_sep_char,
+                               allow_loose_quotes => 1,
+                               escape_char => undef
+                       }
+               );
 
                # Parse csvlog lines
                while (my $row = $csv->getline($lfile)) {
@@ -2019,7 +2027,7 @@ sub process_file
                        }
                }
                if (!$getout) {
-                       $csv->eof or warn "FATAL: cannot use CSV, " . $csv->error_diag() . "\n";
+                       $csv->eof or warn "FATAL: cannot use CSV on $logfile, " . $csv->error_diag() . "\n";
                }
 
        }