From 7c13781ee7a617235f24617e3bd7628cda95df15 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 14 Apr 2005 01:38:22 +0000 Subject: 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. --- doc/src/sgml/bki.sgml | 146 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 115 insertions(+), 31 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/bki.sgml b/doc/src/sgml/bki.sgml index 7aec23130d6..23a036c9c24 100644 --- a/doc/src/sgml/bki.sgml +++ b/doc/src/sgml/bki.sgml @@ -1,5 +1,5 @@ @@ -58,7 +58,7 @@ $PostgreSQL: pgsql/doc/src/sgml/bki.sgml,v 1.15 2005/04/13 18:54:55 tgl Exp $ - Lines starting with a # are ignored. + Lines starting with # are ignored. @@ -69,11 +69,12 @@ $PostgreSQL: pgsql/doc/src/sgml/bki.sgml,v 1.15 2005/04/13 18:54:55 tgl Exp $ - create - bootstrap - shared_relation - without_oids + create + bootstrap + shared_relation + without_oids tablename + tableoid (name1 = type1 , name2 = Create a table named tablename with the columns given - in parentheses. + class="parameter">tablename, and having the OID + tableoid, + with the columns given in parentheses. @@ -101,7 +103,9 @@ $PostgreSQL: pgsql/doc/src/sgml/bki.sgml,v 1.15 2005/04/13 18:54:55 tgl Exp $ _aclitem (array). Although it is possible to create tables containing columns of other types, this cannot be done until after pg_type has been created and filled with - appropriate entries. + appropriate entries. (That effectively means that only these + column types can be used in bootstrapped tables, but non-bootstrap + catalogs can contain any built-in type.) @@ -125,38 +129,34 @@ $PostgreSQL: pgsql/doc/src/sgml/bki.sgml,v 1.15 2005/04/13 18:54:55 tgl Exp $ - open tablename + open tablename - Open the table called + Open the table named tablename - for further manipulation. + for insertion of data. Any currently open table is closed. - close tablename + close tablename - Close the open table called tablename. It is an error if - tablename is not - already opened. If no tablename is given, then the - currently open table is closed. + Close the open table. The name of the table can be given as a + cross-check, but this is not required. - insert OID = oid_value (value1 value2 ...) + insert OID = oid_value ( value1 value2 ... ) @@ -181,19 +181,23 @@ $PostgreSQL: pgsql/doc/src/sgml/bki.sgml,v 1.15 2005/04/13 18:54:55 tgl Exp $ - declare unique index indexname on tablename using amname (opclass1 name1 , ...) + declare unique + index indexname + indexoid + on tablename + using amname + ( opclass1 + name1 + , ... ) Create an index named indexname on the table named - tablename using the + class="parameter">indexname, having OID + indexoid, + on the table named + tablename, using the amname access method. The fields to index are called name1, - build indices + build indices @@ -220,17 +224,97 @@ $PostgreSQL: pgsql/doc/src/sgml/bki.sgml,v 1.15 2005/04/13 18:54:55 tgl Exp $ + + Structure of the Bootstrap <acronym>BKI</acronym> File + + + The open command cannot be used until the tables it uses + exist and have entries for the table that is to be opened. + (These minimum tables are pg_class, + pg_attribute, pg_proc, and + pg_type.) To allow those tables themselves to be filled, + create with the bootstrap option implicitly opens + the created table for data insertion. + + + + Thus, the structure of the postgres.bki file has to + be: + + + + create bootstrap one of the critical tables + + + + + insert data describing at least the critical tables + + + + + close + + + + + Repeat for the other critical tables. + + + + + create (without bootstrap) a noncritical table + + + + + open + + + + + insert desired data + + + + + close + + + + + Repeat for the other noncritical tables. + + + + + Define indexes. + + + + + build indices + + + + + + + There are doubtless other, undocumented ordering dependencies. + + + Example The following sequence of commands will create the - table test_table with two columns + table test_table with OID 420, having two columns cola and colb of type int4 and text, respectively, and insert two rows into the table. -create test_table (cola = int4, colb = text) +create test_table 420 (cola = int4, colb = text) open test_table insert OID=421 ( 1 "value1" ) insert OID=422 ( 2 _null_ ) -- cgit v1.2.3