diff --git a/doc/src/sgml/bki.sgml b/doc/src/sgml/bki.sgml index e7acd652e7..5b557ffb7b 100644 --- a/doc/src/sgml/bki.sgml +++ b/doc/src/sgml/bki.sgml @@ -594,7 +594,7 @@ Run the new script: $ cd src/include/catalog -$ perl -I ../../backend/catalog rewrite_dat_with_prokind.pl pg_proc.dat +$ perl rewrite_dat_with_prokind.pl pg_proc.dat At this point pg_proc.dat has all three columns, prokind, diff --git a/src/include/catalog/reformat_dat_file.pl b/src/include/catalog/reformat_dat_file.pl old mode 100644 new mode 100755 index 4d2523c1bf..00c4f2b0a0 --- a/src/include/catalog/reformat_dat_file.pl +++ b/src/include/catalog/reformat_dat_file.pl @@ -1,13 +1,14 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl #---------------------------------------------------------------------- # # reformat_dat_file.pl -# Perl script that reads in a catalog data file and writes out -# a functionally equivalent file in a standard format. +# Perl script that reads in catalog data file(s) and writes out +# functionally equivalent file(s) in a standard format. # -# 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 blank lines are preserved. +# In each entry of a reformatted file, metadata fields (if any) come +# first, with normal attributes starting on the following line, in +# the same order as the columns of the corresponding catalog. +# 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 @@ -16,11 +17,15 @@ # #---------------------------------------------------------------------- -use Catalog; - use strict; use warnings; +# If you copy this script to somewhere other than src/include/catalog, +# you'll need to modify this "use lib" or provide a suitable -I switch. +use FindBin; +use lib "$FindBin::RealBin/../../backend/catalog/"; +use Catalog; + my @input_files; my $output_path = ''; my $full_tuples = 0; @@ -293,13 +298,10 @@ sub usage Usage: reformat_dat_file.pl [options] datafile... Options: - -o output path + -o PATH write output files to PATH instead of current directory --full-tuples write out full tuples, including default values Expects a list of .dat files as arguments. -Make sure location of Catalog.pm is passed to the perl interpreter: -perl -I /path/to/Catalog.pm/ ... - EOM }