Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit84549eb

Browse files
committed
Tweak reformat_dat_file.pl to make it more easily hand-invokable.
Use the same code we already applied in duplicate_oids and unused_oidsto let this script find Catalog.pm without help. This removes the needto supply a -I switch in most cases.Also, mark the script executable, again to follow the precedent ofduplicate_oids and unused_oids. Now you can just do"./reformat_dat_file.pl pg_proc.dat"if you want to reformat only one or a few .dat files rather than all.It'd be possible to remove the -I switches in the Makefile's conveniencetargets, but I chose to leave them: they don't hurt anything, and it'spossible that in weird VPATH situations they might be of value.
1 parent45c6d75 commit84549eb

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

‎doc/src/sgml/bki.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@
594594
Run the new script:
595595
<programlisting>
596596
$ cd src/include/catalog
597-
$ perl-I ../../backend/catalog rewrite_dat_with_prokind.pl pg_proc.dat
597+
$ perl rewrite_dat_with_prokind.pl pg_proc.dat
598598
</programlisting>
599599
At this point <filename>pg_proc.dat</filename> has all three
600600
columns, <structfield>prokind</structfield>,

‎src/include/catalog/reformat_dat_file.pl

100644100755
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
#!/usr/bin/perl -w
1+
#!/usr/bin/perl
22
#----------------------------------------------------------------------
33
#
44
# reformat_dat_file.pl
5-
# Perl script that reads inacatalog data file and writes out
6-
#afunctionally equivalent file in a standard format.
5+
# Perl script that reads in catalog data file(s) and writes out
6+
# functionally equivalent file(s) in a standard format.
77
#
8-
# Metadata entries (if any) come first, with normal attributes
9-
# starting on the following line, in the same order they would be in
10-
# the corresponding table. Comments and blank lines are preserved.
8+
# In each entry of a reformatted file, metadata fields (if any) come
9+
# first, with normal attributes starting on the following line, in
10+
# the same order as the columns of the corresponding catalog.
11+
# Comments and blank lines are preserved.
1112
#
1213
# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
1314
# Portions Copyright (c) 1994, Regents of the University of California
@@ -16,11 +17,15 @@
1617
#
1718
#----------------------------------------------------------------------
1819

19-
use Catalog;
20-
2120
use strict;
2221
use warnings;
2322

23+
# If you copy this script to somewhere other than src/include/catalog,
24+
# you'll need to modify this "use lib" or provide a suitable -I switch.
25+
use FindBin;
26+
use lib"$FindBin::RealBin/../../backend/catalog/";
27+
use Catalog;
28+
2429
my@input_files;
2530
my$output_path ='';
2631
my$full_tuples = 0;
@@ -293,13 +298,10 @@ sub usage
293298
Usage: reformat_dat_file.pl [options] datafile...
294299
295300
Options:
296-
-o output path
301+
-oPATHwrite output files to PATH instead of current directory
297302
--full-tuples write out full tuples, including default values
298303
299304
Expects a list of .dat files as arguments.
300305
301-
Make sure location of Catalog.pm is passed to the perl interpreter:
302-
perl -I /path/to/Catalog.pm/ ...
303-
304306
EOM
305307
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp