1997-03-15 07:03:08 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# unused_oids
|
|
|
|
#
|
2003-11-29 20:52:15 +01:00
|
|
|
# $PostgreSQL: pgsql/src/include/catalog/unused_oids,v 1.5 2003/11/29 19:52:08 pgsql Exp $
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
|
|
|
# finds blocks of oids that have not already been claimed by
|
|
|
|
# post_hackers for internal purposes. primarily useful for
|
|
|
|
# finding valid oids for new internal function oids. the numbers
|
|
|
|
# printed are inclusive ranges of valid (unused) oids.
|
|
|
|
#
|
|
|
|
# before using a large empty block, make sure you aren't about
|
|
|
|
# to take over what was intended as expansion space for something
|
|
|
|
# else. also, before using a number, do a "grepsrc" to make sure
|
|
|
|
# that someone isn't using a literal numeric constant somewhere..
|
|
|
|
#
|
|
|
|
# non-berkeley post_hackers should probably not try to use oids
|
|
|
|
# less than the highest one that comes with the distributed source.
|
|
|
|
#
|
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"
|
|
|
|
|
|
|
|
# Get FirstGenBKIObjectId from access/transam.h
|
|
|
|
BKIOBJECTID=`grep '#define[ ]*FirstGenBKIObjectId' ../access/transam.h | $AWK '{ print $3 }'`
|
|
|
|
export BKIOBJECTID
|
|
|
|
|
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 {
|
2001-08-10 20:57:42 +02:00
|
|
|
print last + 1, "-", ENVIRON["BKIOBJECTID"]-1;
|
1997-03-15 07:03:08 +01:00
|
|
|
}'
|