1997-03-15 07:03:08 +01:00
|
|
|
#!/bin/sh
|
2005-04-13 20:54:57 +02:00
|
|
|
#
|
1997-03-15 07:03:08 +01:00
|
|
|
# unused_oids
|
|
|
|
#
|
2005-04-13 20:54:57 +02:00
|
|
|
# $PostgreSQL: pgsql/src/include/catalog/unused_oids,v 1.6 2005/04/13 18:54:57 tgl Exp $
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
2005-04-13 20:54:57 +02:00
|
|
|
# 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.
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
|
|
|
# before using a large empty block, make sure you aren't about
|
|
|
|
# to take over what was intended as expansion space for something
|
2005-04-13 20:54:57 +02:00
|
|
|
# else.
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
2000-01-17 01:53:11 +01:00
|
|
|
# run this script in src/include/catalog.
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
2001-08-10 20:57:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
AWK="awk"
|
|
|
|
|
2005-04-13 20:54:57 +02:00
|
|
|
# Get FirstBootstrapObjectId from access/transam.h
|
|
|
|
FIRSTOBJECTID=`grep '#define[ ]*FirstBootstrapObjectId' ../access/transam.h | $AWK '{ print $3 }'`
|
|
|
|
export FIRSTOBJECTID
|
2001-08-10 20:57:42 +02:00
|
|
|
|
1997-03-15 07:03:08 +01:00
|
|
|
egrep '^DATA' pg_*.h | \
|
|
|
|
sed -e 's/^.*OID[^=]*=[^0-9]*//' -e 's/[^0-9].*$//' | \
|
|
|
|
sort -n | \
|
|
|
|
uniq | \
|
2001-08-10 20:57:42 +02:00
|
|
|
$AWK '
|
1997-03-15 07:03:08 +01:00
|
|
|
BEGIN {
|
|
|
|
last = 0;
|
|
|
|
}
|
|
|
|
/^[0-9]/ {
|
|
|
|
if ($1 > last + 1) {
|
|
|
|
if ($1 > last + 2) {
|
|
|
|
print last + 1, "-", $1 - 1;
|
|
|
|
} else {
|
|
|
|
print last + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
last = $1;
|
|
|
|
}
|
|
|
|
END {
|
2005-04-13 20:54:57 +02:00
|
|
|
print last + 1, "-", ENVIRON["FIRSTOBJECTID"]-1;
|
1997-03-15 07:03:08 +01:00
|
|
|
}'
|