Skip to content

Commit 2cdf359

Browse files
committed
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/[email protected]
1 parent af1a949 commit 2cdf359

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

doc/src/sgml/bki.sgml

+6-8
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,19 @@
129129
</para>
130130

131131
<para>
132-
Frontend code should not include any <structname>pg_xxx.h</structname>
132+
Frontend code should not include any <filename>pg_xxx.h</filename>
133133
catalog header file, as these files may contain C code that won't compile
134134
outside the backend. (Typically, that happens because these files also
135135
contain declarations for functions
136136
in <filename>src/backend/catalog/</filename> files.)
137137
Instead, frontend code may include the corresponding
138-
generated <structname>pg_xxx_d.h</structname> header, which will contain
138+
generated <filename>pg_xxx_d.h</filename> header, which will contain
139139
OID <literal>#define</literal>s and any other data that might be of use
140140
on the client side. If you want macros or other code in a catalog header
141141
to be visible to frontend code, write <literal>#ifdef
142142
EXPOSE_TO_CLIENT_CODE</literal> ... <literal>#endif</literal> around that
143143
section to instruct <filename>genbki.pl</filename> to copy that section
144-
to the <structname>pg_xxx_d.h</structname> header.
144+
to the <filename>pg_xxx_d.h</filename> header.
145145
</para>
146146

147147
<para>
@@ -419,11 +419,9 @@
419419
Use of symbolic references is enabled in a particular catalog column
420420
by attaching <literal>BKI_LOOKUP(<replaceable>lookuprule</replaceable>)</literal>
421421
to the column's definition, where <replaceable>lookuprule</replaceable>
422-
is <structname>pg_am</structname>, <structname>pg_proc</structname>,
423-
<structname>pg_operator</structname>,
424-
<structname>pg_opclass</structname>,
425-
<structname>pg_opfamily</structname>,
426-
or <structname>pg_type</structname>.
422+
is <literal>pg_am</literal>, <literal>pg_proc</literal>,
423+
<literal>pg_operator</literal>, <literal>pg_opclass</literal>,
424+
<literal>pg_opfamily</literal>, or <literal>pg_type</literal>.
427425
<literal>BKI_LOOKUP</literal> can be attached to columns of
428426
type <type>Oid</type>, <type>regproc</type>, <type>oidvector</type>,
429427
or <type>Oid[]</type>; in the latter two cases it implies performing a

src/include/catalog/reformat_dat_file.pl

+2-9
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#
88
# Metadata entries (if any) come first, with normal attributes
99
# starting on the following line, in the same order they would be in
10-
# the corresponding table. Comments and non-consecutive blank lines
11-
# are preserved.
10+
# the corresponding table. Comments and blank lines are preserved.
1211
#
1312
# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
1413
# Portions Copyright (c) 1994, Regents of the University of California
@@ -109,7 +108,6 @@
109108
my $catalog = $catalogs{$catname};
110109
my @attnames;
111110
my $schema = $catalog->{columns};
112-
my $prev_blank = 0;
113111

114112
foreach my $column (@$schema)
115113
{
@@ -158,27 +156,22 @@
158156
my $data_str = format_hash(\%values, @attnames);
159157
print $dat $data_str;
160158
print $dat " },\n";
161-
$prev_blank = 0;
162159
}
163160

164161
# Strings -- handle accordingly or ignore. It was necessary to
165162
# ignore bare commas during the initial data conversion. This
166163
# should be a no-op now, but we may as well keep that behavior.
167-
# Note: We don't update $prev_blank if we ignore a string.
168164

169-
# Preserve non-consecutive blank lines.
165+
# Preserve blank lines.
170166
elsif ($data =~ /^\s*$/)
171167
{
172-
next if $prev_blank;
173168
print $dat "\n";
174-
$prev_blank = 1;
175169
}
176170

177171
# Preserve comments or brackets that are on their own line.
178172
elsif ($data =~ /^\s*(\[|\]|#.*?)\s*$/)
179173
{
180174
print $dat "$1\n";
181-
$prev_blank = 0;
182175
}
183176
}
184177
close $dat;

0 commit comments

Comments
 (0)