2018-04-25 22:01:47 +02:00
|
|
|
#!/usr/bin/perl
|
2018-04-26 17:19:52 +02:00
|
|
|
#----------------------------------------------------------------------
|
2005-04-13 20:54:57 +02:00
|
|
|
#
|
1997-03-15 07:03:08 +01:00
|
|
|
# unused_oids
|
2018-04-26 17:19:52 +02:00
|
|
|
# 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.
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
2018-04-26 17:19:52 +02:00
|
|
|
# Before using a large empty block, make sure you aren't about
|
|
|
|
# to take over what was intended as expansion space for something
|
|
|
|
# else.
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
2018-04-26 17:19:52 +02:00
|
|
|
# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
|
|
|
|
# Portions Copyright (c) 1994, Regents of the University of California
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
2018-04-26 17:19:52 +02:00
|
|
|
# src/include/catalog/unused_oids
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
2018-04-26 17:19:52 +02:00
|
|
|
#----------------------------------------------------------------------
|
2001-08-10 20:57:42 +02:00
|
|
|
|
2018-04-25 22:01:47 +02:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
2001-08-10 20:57:42 +02:00
|
|
|
|
2018-04-26 17:19:52 +02:00
|
|
|
# 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;
|
|
|
|
|
2018-04-25 22:01:47 +02:00
|
|
|
my @input_files = (glob("pg_*.h"), qw(indexing.h toasting.h));
|
2001-08-10 20:57:42 +02:00
|
|
|
|
2018-04-25 22:01:47 +02:00
|
|
|
my $oids = Catalog::FindAllOidsFromHeaders(@input_files);
|
2001-08-10 20:57:42 +02:00
|
|
|
|
2018-04-25 22:01:47 +02:00
|
|
|
# Also push FirstBootstrapObjectId to serve as a terminator for the last gap.
|
|
|
|
my $FirstBootstrapObjectId =
|
2018-05-19 22:04:47 +02:00
|
|
|
Catalog::FindDefinedSymbol('access/transam.h', '..',
|
2018-04-25 22:01:47 +02:00
|
|
|
'FirstBootstrapObjectId');
|
|
|
|
push @{$oids}, $FirstBootstrapObjectId;
|
2005-04-14 03:38:22 +02:00
|
|
|
|
2018-04-25 22:01:47 +02:00
|
|
|
my $prev_oid = 0;
|
|
|
|
foreach my $oid (sort { $a <=> $b } @{$oids})
|
|
|
|
{
|
|
|
|
if ($oid > $prev_oid + 1)
|
|
|
|
{
|
|
|
|
if ($oid > $prev_oid + 2)
|
|
|
|
{
|
|
|
|
printf "%d - %d\n", $prev_oid + 1, $oid - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf "%d\n", $prev_oid + 1;
|
1997-03-15 07:03:08 +01:00
|
|
|
}
|
|
|
|
}
|
2018-04-25 22:01:47 +02:00
|
|
|
$prev_oid = $oid;
|
1997-03-15 07:03:08 +01:00
|
|
|
}
|