aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-04-09 14:58:39 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-04-09 14:58:39 -0400
commit2cdf359fc4471c488fbb0dbd31678d78c3c1043b (patch)
treeeceb2bcf0abc4198306b58b0ec100967c1565b8a /src
parentaf1a949109d8212711df943c053b1038c0afdae1 (diff)
downloadpostgresql-2cdf359fc4471c488fbb0dbd31678d78c3c1043b.tar.gz
postgresql-2cdf359fc4471c488fbb0dbd31678d78c3c1043b.zip
Make reformat_dat_file.pl preserve all blank lines.
In its original form, reformat_dat_file.pl smashed consecutive blank lines to a single blank line, which was helpful for mopping up excess whitespace during the bootstrap data format conversion. But going forward, there seems little reason to do that; if developers want to put in multiple blank lines, let 'em. This makes it conform to the documentation I (tgl) wrote, too. In passing, clean up some sloppy markup choices in bki.sgml. John Naylor Discussion: https://postgr.es/m/28827.1523039259@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r--src/include/catalog/reformat_dat_file.pl11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/include/catalog/reformat_dat_file.pl b/src/include/catalog/reformat_dat_file.pl
index bbceb16b65d..038ba7bb05e 100644
--- a/src/include/catalog/reformat_dat_file.pl
+++ b/src/include/catalog/reformat_dat_file.pl
@@ -7,8 +7,7 @@
#
# Metadata entries (if any) come first, with normal attributes
# starting on the following line, in the same order they would be in
-# the corresponding table. Comments and non-consecutive blank lines
-# are preserved.
+# the corresponding table. Comments and blank lines are preserved.
#
# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
@@ -109,7 +108,6 @@ foreach my $catname (@catnames)
my $catalog = $catalogs{$catname};
my @attnames;
my $schema = $catalog->{columns};
- my $prev_blank = 0;
foreach my $column (@$schema)
{
@@ -158,27 +156,22 @@ foreach my $catname (@catnames)
my $data_str = format_hash(\%values, @attnames);
print $dat $data_str;
print $dat " },\n";
- $prev_blank = 0;
}
# Strings -- handle accordingly or ignore. It was necessary to
# ignore bare commas during the initial data conversion. This
# should be a no-op now, but we may as well keep that behavior.
- # Note: We don't update $prev_blank if we ignore a string.
- # Preserve non-consecutive blank lines.
+ # Preserve blank lines.
elsif ($data =~ /^\s*$/)
{
- next if $prev_blank;
print $dat "\n";
- $prev_blank = 1;
}
# Preserve comments or brackets that are on their own line.
elsif ($data =~ /^\s*(\[|\]|#.*?)\s*$/)
{
print $dat "$1\n";
- $prev_blank = 0;
}
}
close $dat;