head	1.9;
access;
symbols
	REL9_0_0:1.9
	REL9_1_ALPHA1:1.9
	REL9_0_RC1:1.9
	REL9_0_BETA4:1.9
	REL9_0_STABLE:1.9.0.10
	REL9_0_BETA3:1.9
	REL9_0_BETA2:1.9
	REL7_4_29:1.4
	REL8_0_25:1.5
	REL8_1_21:1.7
	REL8_2_17:1.8
	REL8_3_11:1.8
	REL8_4_4:1.8
	REL9_0_BETA1:1.9
	REL9_0_ALPHA5_BRANCH:1.9.0.8
	REL9_0_ALPHA5:1.9
	REL7_4_28:1.4
	REL8_0_24:1.5
	REL8_1_20:1.7
	REL8_2_16:1.8
	REL8_3_10:1.8
	REL8_4_3:1.8
	REL9_0_ALPHA4:1.9
	REL9_0_ALPHA4_BRANCH:1.9.0.6
	REL8_5_ALPHA3:1.9
	REL8_5_ALPHA3_BRANCH:1.9.0.4
	REL7_4_27:1.4
	REL8_0_23:1.5
	REL8_1_19:1.7
	REL8_2_15:1.8
	REL8_3_9:1.8
	REL8_4_2:1.8
	REL8_5_ALPHA2:1.9
	REL8_5_ALPHA2_BRANCH:1.9.0.2
	REL7_4_26:1.4
	REL8_0_22:1.5
	REL8_1_18:1.7
	REL8_2_14:1.8
	REL8_3_8:1.8
	REL8_4_1:1.8
	REL8_5_ALPHA1:1.8
	REL8_5_ALPHA1_BRANCH:1.8.0.8
	REL8_4_STABLE:1.8.0.6
	REL8_4_0:1.8
	REL8_4_RC2:1.8
	REL8_4_RC1:1.8
	REL8_4_BETA2:1.8
	REL8_4_BETA1:1.8
	REL7_4_25:1.4
	REL8_0_21:1.5
	REL8_1_17:1.7
	REL8_2_13:1.8
	REL8_3_7:1.8
	REL7_4_24:1.4
	REL8_0_20:1.5
	REL8_1_16:1.7
	REL8_2_12:1.8
	REL8_3_6:1.8
	REL7_4_23:1.4
	REL8_0_19:1.5
	REL8_1_15:1.7
	REL8_2_11:1.8
	REL8_3_5:1.8
	REL7_4_22:1.4
	REL8_0_18:1.5
	REL8_1_14:1.7
	REL8_2_10:1.8
	REL8_3_4:1.8
	REL7_4_21:1.4
	REL8_0_17:1.5
	REL8_1_13:1.7
	REL8_2_9:1.8
	REL8_3_3:1.8
	REL7_4_20:1.4
	REL8_0_16:1.5
	REL8_1_12:1.7
	REL8_2_8:1.8
	REL8_3_2:1.8
	REL8_2_7:1.8
	REL8_3_1:1.8
	REL8_3_STABLE:1.8.0.4
	REL8_3_0:1.8
	REL8_3_RC2:1.8
	REL7_3_21:1.4
	REL7_4_19:1.4
	REL8_0_15:1.5
	REL8_1_11:1.7
	REL8_2_6:1.8
	REL8_3_RC1:1.8
	REL8_3_BETA4:1.8
	REL8_3_BETA3:1.8
	REL8_3_BETA2:1.8
	REL8_3_BETA1:1.8
	REL7_3_20:1.4
	REL7_4_18:1.4
	REL8_0_14:1.5
	REL8_1_10:1.7
	REL8_2_5:1.8
	REL7_3_19:1.4
	REL7_4_17:1.4
	REL8_0_13:1.5
	REL8_1_9:1.7
	REL8_2_4:1.8
	REL8_0_12:1.5
	REL8_1_8:1.7
	REL8_2_3:1.8
	REL7_3_18:1.4
	REL7_4_16:1.4
	REL8_0_11:1.5
	REL8_1_7:1.7
	REL8_2_2:1.8
	REL8_0_10:1.5
	REL8_1_6:1.7
	REL8_2_1:1.8
	REL7_4_15:1.4
	REL7_3_17:1.4
	REL8_2_STABLE:1.8.0.2
	REL8_2_0:1.8
	REL8_2_RC1:1.8
	REL8_2_BETA3:1.8
	REL8_2_BETA2:1.8
	REL8_1_5:1.7
	REL8_0_9:1.5
	REL7_4_14:1.4
	REL7_3_16:1.4
	REL8_2_BETA1:1.8
	REL7_3_15:1.4
	REL7_4_13:1.4
	REL8_0_8:1.5
	REL8_1_4:1.7
	REL7_3_14:1.4
	REL7_4_12:1.4
	REL8_0_7:1.5
	REL8_1_3:1.7
	REL7_3_13:1.4
	REL7_4_11:1.4
	REL8_0_6:1.5
	REL8_1_2:1.7
	REL7_3_12:1.4
	REL7_4_10:1.4
	REL8_0_5:1.5
	REL8_1_1:1.7
	REL8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1.3.0.4
	REL7_1_BETA:1.3
	REL7_1_BETA3:1.3
	REL7_1_BETA2:1.3
	REL7_1:1.3
	REL7_0_PATCHES:1.3.0.2
	REL7_0:1.3
	REL6_5_PATCHES:1.2.0.2
	REL6_5:1.2
	REL6_4:1.1.0.2
	release-6-3:1.1;
locks; strict;
comment	@# @;


1.9
date	2009.09.26.22.42.03;	author tgl;	state Exp;
branches;
next	1.8;

1.8
date	2006.07.31.01.16.38;	author tgl;	state Exp;
branches;
next	1.7;

1.7
date	2005.04.14.01.38.21;	author tgl;	state Exp;
branches;
next	1.6;

1.6
date	2005.04.13.18.54.57;	author tgl;	state Exp;
branches;
next	1.5;

1.5
date	2003.11.29.19.52.08;	author pgsql;	state Exp;
branches;
next	1.4;

1.4
date	2001.08.10.18.57.41;	author tgl;	state Exp;
branches;
next	1.3;

1.3
date	2000.01.17.00.53.11;	author tgl;	state Exp;
branches;
next	1.2;

1.2
date	98.12.31.20.09.49;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	97.03.15.06.03.08;	author scrappy;	state Exp;
branches;
next	;


desc
@@


1.9
log
@Extend the BKI infrastructure to allow system catalogs to be given
hand-assigned rowtype OIDs, even when they are not "bootstrapped" catalogs
that have handmade type rows in pg_type.h.  Give pg_database such an OID.
Restore the availability of C macros for the rowtype OIDs of the bootstrapped
catalogs.  (These macros are now in the individual catalogs' .h files,
though, not in pg_type.h.)

This commit doesn't do anything especially useful by itself, but it's
necessary infrastructure for reverting some ill-considered changes in
relcache.c.
@
text
@#!/bin/sh
#
# unused_oids
#
# $PostgreSQL: pgsql/src/include/catalog/unused_oids,v 1.8 2006/07/31 01:16:38 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

# this part (down to the uniq step) should match the duplicate_oids script
# note: we exclude BKI_BOOTSTRAP relations since they are expected to have
# matching DATA lines in pg_class.h and pg_type.h

cat pg_*.h toasting.h indexing.h | \
egrep -v -e '^CATALOG\(.*BKI_BOOTSTRAP' | \
sed -n	-e 's/^DATA(insert *OID *= *\([0-9][0-9]*\).*$/\1/p' \
	-e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*BKI_ROWTYPE_OID(\([0-9][0-9]*\)).*$/\1,\2/p' \
	-e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*$/\1/p' \
	-e 's/^DECLARE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' \
	-e 's/^DECLARE_UNIQUE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' \
	-e 's/^DECLARE_TOAST([^,]*, *\([0-9][0-9]*\), *\([0-9][0-9]*\).*$/\1,\2/p' | \
tr ',' '\n' | \
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;
}'
@


1.8
log
@Change the bootstrap sequence so that toast tables for system catalogs are
created in the bootstrap phase proper, rather than added after-the-fact
by initdb.  This is cleaner than before because it allows us to retire the
undocumented ALTER TABLE ... CREATE TOAST TABLE command, but the real reason
I'm doing it is so that toast tables of shared catalogs will now have
predetermined OIDs.  This will allow a reasonably clean solution to the
problem of locking tables before we load their relcache entries, to appear
in a forthcoming patch.
@
text
@d5 1
a5 1
# $PostgreSQL: pgsql/src/include/catalog/unused_oids,v 1.7 2005/04/14 01:38:21 tgl Exp $
d28 1
a28 1
# matching DATA lines in pg_class.h
d33 1
@


1.7
log
@First phase of project to use fixed OIDs for all system catalogs and
indexes.  Extend the macros in include/catalog/*.h to carry the info
about hand-assigned OIDs, and adjust the genbki script and bootstrap
code to make the relations actually get those OIDs.  Remove the small
number of RelOid_pg_foo macros that we had in favor of a complete
set named like the catname.h and indexing.h macros.  Next phase will
get rid of internal use of names for looking up catalogs and indexes;
but this completes the changes forcing an initdb, so it looks like a
good place to commit.
Along the way, I made the shared relations (pg_database etc) not be
'bootstrap' relations any more, so as to reduce the number of hardwired
entries and simplify changing those relations in future.  I'm not
sure whether they ever really needed to be handled as bootstrap
relations, but it seems to work fine to not do so now.
@
text
@d5 1
a5 1
# $PostgreSQL: pgsql/src/include/catalog/unused_oids,v 1.6 2005/04/13 18:54:57 tgl Exp $
d26 1
a26 1
# this part (down to the uniq step) should match the unused_oids script
d30 1
a30 1
cat pg_*.h indexing.h | \
d35 3
a37 1
	-e 's/^DECLARE_UNIQUE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' | \
@


1.6
log
@Simplify initdb-time assignment of OIDs as I proposed yesterday, and
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.
@
text
@d5 1
a5 1
# $PostgreSQL: pgsql/src/include/catalog/unused_oids,v 1.5 2003/11/29 19:52:08 pgsql Exp $
d26 13
a38 5
egrep '^DATA' pg_*.h | \
	sed -e 's/^.*OID[^=]*=[^0-9]*//' -e 's/[^0-9].*$//' | \
	sort -n | \
	uniq | \
	$AWK '
@


1.5
log
@
$Header: -> $PostgreSQL Changes ...
@
text
@d2 1
d5 1
a5 1
# $PostgreSQL: /cvsroot/pgsql-server/src/include/catalog/unused_oids,v 1.4 2001/08/10 18:57:41 tgl Exp $
d7 4
a10 4
#	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.
d14 1
a14 5
#	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.
d22 3
a24 3
# Get FirstGenBKIObjectId from access/transam.h
BKIOBJECTID=`grep '#define[ 	]*FirstGenBKIObjectId' ../access/transam.h | $AWK '{ print $3 }'`
export BKIOBJECTID
d45 1
a45 1
	print last + 1, "-", ENVIRON["BKIOBJECTID"]-1;
@


1.4
log
@Make OIDs optional, per discussions in pghackers.  WITH OIDS is still the
default, but OIDS are removed from many system catalogs that don't need them.
Some interesting side effects: TOAST pointers are 20 bytes not 32 now;
pg_description has a three-column key instead of one.

Bugs fixed in passing: BINARY cursors work again; pg_class.relhaspkey
has some usefulness; pg_dump dumps comments on indexes, rules, and
triggers in a valid order.

initdb forced.
@
text
@d4 1
a4 1
# $Header: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/unused_oids,v 1.3 2000/01/17 00:53:11 tgl Exp $
@


1.3
log
@Update unused_oids script so it works with non-GNU awk --- /* ... */
comment style apparently isn't portable to other awks.
@
text
@d4 1
a4 1
# $Header: /usr/local/cvsroot/pgsql/src/include/catalog/unused_oids,v 1.2 1998/12/31 20:09:49 momjian Exp $
d21 8
d33 1
a33 1
	awk '
d48 1
a48 2
# 2^14-1 = current BootstrapObjectIdData value
	print last + 1, "-", 2^14-1;
@


1.2
log
@Add max oid display, rather than returning just a dash for the last entry.
@
text
@d4 1
a4 1
# $Header: /usr/local/cvsroot/pgsql/src/include/catalog/unused_oids,v 1.1 1997/03/15 06:03:08 scrappy Exp $
d19 1
a19 1
#	run this script in src/backend/catalog.
d40 2
a41 1
	print last + 1, "-", 2^14-1; /* current BootstrapObjectIdData value */
@


1.1
log
@A couple of development scripts by Dan to detect unused and duplicate
oids
@
text
@d4 1
a4 1
# $Header: /usr/local/cvsroot/postgres95/include/catalog/unused_oids,v 1.1 1997/02/27 22:52:24 mcguirk Exp $
d40 1
a40 1
	print last + 1, "-";
@
