aboutsummaryrefslogtreecommitdiff
path: root/src/include/catalog/unused_oids
blob: dada47cdfcd6e9fd7bd159ce846179bdd82e9fc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
# unused_oids
#
# $Header: /cvsroot/pgsql/src/include/catalog/unused_oids,v 1.4 2001/08/10 18:57:41 tgl Exp $
#
#	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.
#
#	run this script in src/include/catalog.
#


AWK="awk"

# Get FirstGenBKIObjectId from access/transam.h
BKIOBJECTID=`grep '#define[ 	]*FirstGenBKIObjectId' ../access/transam.h | $AWK '{ print $3 }'`
export BKIOBJECTID

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["BKIOBJECTID"]-1;
}'