#!/usr/bin/perl use strict; use warnings; BEGIN { @ARGV = (glob("pg_*.h"), qw(indexing.h toasting.h)); } my %oidcounts; while(<>) { next if /^CATALOG\(.*BKI_BOOTSTRAP/; next unless /^DATA\(insert *OID *= *(\d+)/ || /^CATALOG\([^,]*, *(\d+).*BKI_ROWTYPE_OID\((\d+)\)/ || /^CATALOG\([^,]*, *(\d+)/ || /^DECLARE_INDEX\([^,]*, *(\d+)/ || /^DECLARE_UNIQUE_INDEX\([^,]*, *(\d+)/ || /^DECLARE_TOAST\([^,]*, *(\d+), *(\d+)/; $oidcounts{$1}++; $oidcounts{$2}++ if $2; } my $firstobjectid; my $handle; open($handle,"../access/transam.h") || die "cannot access transam.h: $!"; while (<$handle>) { if (/^#define\s+FirstBootstrapObjectId\s+(\d+)/) { $firstobjectid = $1; last; } } close($handle); die "no first object found" unless $firstobjectid; my $last = 0; foreach my $oid (sort {$a <=> $b} keys %oidcounts) { if ($oid > $last + 1) { if ($oid > $last + 2) { print $last + 1, "-", $oid - 1,"\n"; } else { print $last + 1,"\n"; } } $last = $oid; } print $last + 1, "-" , $firstobjectid -1, "\n"; exit 0;