blob: c34c0378f0c133902c8a86d7d2a38801e8c9cc8c [file] [log] [blame]
#!/usr/bin/env perl
#----------------------------------------------------------------------
#
# 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-2021, 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"), glob("gp_*.h"));
my $oids = Catalog::FindAllOidsFromHeaders(@input_files);
my %oidcounts;
# preserved oid for PAX table AM
$oidcounts{7047}++;
foreach my $oid (@{$oids})
{
$oidcounts{$oid}++;
}
my $found = 0;
foreach my $oid (sort { $a <=> $b } keys %oidcounts)
{
next unless $oidcounts{$oid} > 1;
$found = 1;
print "$oid\n";
}
exit $found;