aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/catalog/duplicate_oids26
-rwxr-xr-xsrc/include/catalog/unused_oids36
2 files changed, 42 insertions, 20 deletions
diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids
index 0d7aa15559b..072fc00c704 100755
--- a/src/include/catalog/duplicate_oids
+++ b/src/include/catalog/duplicate_oids
@@ -1,11 +1,31 @@
#!/usr/bin/perl
-
-use lib '../../backend/catalog/';
-use Catalog;
+#----------------------------------------------------------------------
+#
+# duplicate_oids
+# Identifies any manually-assigned OIDs that are used multiple times
+# in the Postgres catalog data.
+#
+# While duplicate OIDs would only cause a failure if they appear in
+# the same catalog, our project policy is that manually assigned OIDs
+# should be globally unique, to avoid confusion.
+#
+# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
+# src/include/catalog/duplicate_oids
+#
+#----------------------------------------------------------------------
use strict;
use warnings;
+# Must run in src/include/catalog
+use FindBin;
+chdir $FindBin::RealBin or die "could not cd to $FindBin::RealBin: $!\n";
+
+use lib "$FindBin::RealBin/../../backend/catalog/";
+use Catalog;
+
my @input_files = (glob("pg_*.h"), qw(indexing.h toasting.h));
my $oids = Catalog::FindAllOidsFromHeaders(@input_files);
diff --git a/src/include/catalog/unused_oids b/src/include/catalog/unused_oids
index a727225abcb..2780de052c9 100755
--- a/src/include/catalog/unused_oids
+++ b/src/include/catalog/unused_oids
@@ -1,26 +1,33 @@
#!/usr/bin/perl
+#----------------------------------------------------------------------
#
# unused_oids
+# Finds blocks of manually-assignable OIDs that have not already been
+# claimed by previous hackers. The main use is for finding available
+# OIDs for new internal functions. The numbers printed are inclusive
+# ranges of unused OIDs.
#
-# src/include/catalog/unused_oids
-#
-# finds blocks of manually-assignable oids that have not already been
-# claimed by post_hackers. primarily useful for finding available
-# oids for new internal functions. the numbers printed are inclusive
-# ranges of unused oids.
+# Before using a large empty block, make sure you aren't about
+# to take over what was intended as expansion space for something
+# else.
#
-# before using a large empty block, make sure you aren't about
-# to take over what was intended as expansion space for something
-# else.
+# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
#
-# run this script in src/include/catalog.
+# src/include/catalog/unused_oids
#
-use lib '../../backend/catalog/';
-use Catalog;
+#----------------------------------------------------------------------
use strict;
use warnings;
+# Must run in src/include/catalog
+use FindBin;
+chdir $FindBin::RealBin or die "could not cd to $FindBin::RealBin: $!\n";
+
+use lib "$FindBin::RealBin/../../backend/catalog/";
+use Catalog;
+
my @input_files = (glob("pg_*.h"), qw(indexing.h toasting.h));
my $oids = Catalog::FindAllOidsFromHeaders(@input_files);
@@ -45,10 +52,5 @@ foreach my $oid (sort { $a <=> $b } @{$oids})
printf "%d\n", $prev_oid + 1;
}
}
- elsif ($oid == $prev_oid)
- {
- print "Duplicate oid detected: $oid\n";
- exit 1;
- }
$prev_oid = $oid;
}