2 #----------------------------------------------------------------------
5 # Finds blocks of manually-assignable OIDs that have not already been
6 # claimed by previous hackers. The main use is for finding available
7 # OIDs for new internal functions. The numbers printed are inclusive
8 # ranges of unused OIDs.
10 # Before using a large empty block, make sure you aren't about
11 # to take over what was intended as expansion space for something
14 # Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
15 # Portions Copyright (c) 1994, Regents of the University of California
17 # src/include/catalog/unused_oids
19 #----------------------------------------------------------------------
24 # Must run in src/include/catalog
26 chdir $FindBin::RealBin or die "could not cd to $FindBin::RealBin: $!\n";
28 use lib "$FindBin::RealBin/../../backend/catalog/";
31 my @input_files = (glob("pg_*.h"), qw(indexing.h toasting.h));
33 my $oids = Catalog::FindAllOidsFromHeaders(@input_files);
35 # Also push FirstGenbkiObjectId to serve as a terminator for the last gap.
36 my $FirstGenbkiObjectId =
37 Catalog::FindDefinedSymbol('access/transam.h', '..',
38 'FirstGenbkiObjectId');
39 push @{$oids}, $FirstGenbkiObjectId;
42 foreach my $oid (sort { $a <=> $b } @{$oids})
44 if ($oid > $prev_oid + 1)
46 if ($oid > $prev_oid + 2)
48 printf "%d - %d\n", $prev_oid + 1, $oid - 1;
52 printf "%d\n", $prev_oid + 1;