diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index e91a8e10a8..9dd932e30a 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -287,6 +287,8 @@ sub ParseData my $catname = $1; my $data = []; + if ($preserve_formatting) + { # Scan the input file. while (<$ifd>) { @@ -346,11 +348,24 @@ sub ParseData { push @$data, $hash_ref if !$hash_ref->{autogenerated}; } - elsif ($preserve_formatting) + else { push @$data, $_; } } + } + else + { + # When we only care about the contents, it's faster to read and eval + # the whole file at once. + my $full_file = do { local(@ARGV, $/) = $input_file; <> }; + eval '$data = ' . $full_file; + foreach my $hash_ref (@{$data}) + { + AddDefaultValues($hash_ref, $schema, $catname); + } + } + close $ifd; # If this is pg_type, auto-generate array types too.