mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
avoid encroaching on the 'user' range of OIDs by allowing automatic OID assignment to use values below 16k until we reach normal operation. initdb not forced since this doesn't make any incompatible change; however a lot of stuff will have different OIDs after your next initdb.
46 lines
1 KiB
Bash
Executable file
46 lines
1 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# unused_oids
|
|
#
|
|
# $PostgreSQL: pgsql/src/include/catalog/unused_oids,v 1.6 2005/04/13 18:54:57 tgl Exp $
|
|
#
|
|
# 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.
|
|
#
|
|
# before using a large empty block, make sure you aren't about
|
|
# to take over what was intended as expansion space for something
|
|
# else.
|
|
#
|
|
# run this script in src/include/catalog.
|
|
#
|
|
|
|
|
|
AWK="awk"
|
|
|
|
# Get FirstBootstrapObjectId from access/transam.h
|
|
FIRSTOBJECTID=`grep '#define[ ]*FirstBootstrapObjectId' ../access/transam.h | $AWK '{ print $3 }'`
|
|
export FIRSTOBJECTID
|
|
|
|
egrep '^DATA' pg_*.h | \
|
|
sed -e 's/^.*OID[^=]*=[^0-9]*//' -e 's/[^0-9].*$//' | \
|
|
sort -n | \
|
|
uniq | \
|
|
$AWK '
|
|
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 {
|
|
print last + 1, "-", ENVIRON["FIRSTOBJECTID"]-1;
|
|
}'
|