diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-14 01:38:22 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-14 01:38:22 +0000 |
commit | 7c13781ee7a617235f24617e3bd7628cda95df15 (patch) | |
tree | 5815af97251619f856d480997c71ec9aab3b9262 /src/backend/bootstrap | |
parent | 2193a856a229026673cbc56310cd0bddf7b5ea25 (diff) | |
download | postgresql-7c13781ee7a617235f24617e3bd7628cda95df15.tar.gz |
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.
Diffstat (limited to 'src/backend/bootstrap')
-rw-r--r-- | src/backend/bootstrap/bootparse.y | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index e656e6e638..1945c4074d 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.75 2004/12/31 21:59:34 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.76 2005/04/14 01:38:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -50,6 +50,8 @@ #include "utils/nabstime.h" #include "utils/rel.h" +#define atooid(x) ((Oid) strtoul((x), NULL, 10)) + static void do_start(void) @@ -91,11 +93,10 @@ int num_columns_read = 0; %type <ival> boot_const boot_ident %type <ival> optbootstrap optsharedrelation optwithoutoids %type <ival> boot_tuple boot_tuplelist -%type <oidval> optoideq +%type <oidval> oidspec optoideq %token <ival> CONST_P ID %token OPEN XCLOSE XCREATE INSERT_TUPLE -%token STRING XDEFINE %token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE %token COMMA EQUALS LPAREN RPAREN %token OBJ_ID XBOOTSTRAP XSHARED_RELATION XWITHOUT_OIDS NULLVAL @@ -151,14 +152,15 @@ Boot_CloseStmt: ; Boot_CreateStmt: - XCREATE optbootstrap optsharedrelation optwithoutoids boot_ident LPAREN + XCREATE optbootstrap optsharedrelation optwithoutoids boot_ident oidspec LPAREN { do_start(); numattr = 0; - elog(DEBUG4, "creating%s%s relation %s", + elog(DEBUG4, "creating%s%s relation %s %u", $2 ? " bootstrap" : "", $3 ? " shared" : "", - LexIDStr($5)); + LexIDStr($5), + $6); } boot_typelist { @@ -183,6 +185,7 @@ Boot_CreateStmt: boot_reldesc = heap_create(LexIDStr($5), PG_CATALOG_NAMESPACE, $3 ? GLOBALTABLESPACE_OID : 0, + $6, tupdesc, RELKIND_RELATION, $3, @@ -196,6 +199,7 @@ Boot_CreateStmt: id = heap_create_with_catalog(LexIDStr($5), PG_CATALOG_NAMESPACE, $3 ? GLOBALTABLESPACE_OID : 0, + $6, tupdesc, RELKIND_RELATION, $3, @@ -235,15 +239,16 @@ Boot_InsertStmt: ; Boot_DeclareIndexStmt: - XDECLARE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN + XDECLARE INDEX boot_ident oidspec ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN { do_start(); - DefineIndex(makeRangeVar(NULL, LexIDStr($5)), + DefineIndex(makeRangeVar(NULL, LexIDStr($6)), LexIDStr($3), - LexIDStr($7), + $4, + LexIDStr($8), NULL, - $9, + $10, NULL, NIL, false, false, false, false, false, true, false); @@ -252,15 +257,16 @@ Boot_DeclareIndexStmt: ; Boot_DeclareUniqueIndexStmt: - XDECLARE UNIQUE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN + XDECLARE UNIQUE INDEX boot_ident oidspec ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN { do_start(); - DefineIndex(makeRangeVar(NULL, LexIDStr($6)), + DefineIndex(makeRangeVar(NULL, LexIDStr($7)), LexIDStr($4), - LexIDStr($8), + $5, + LexIDStr($9), NULL, - $10, + $11, NULL, NIL, true, false, false, false, false, true, false); @@ -323,9 +329,13 @@ boot_type_thing: } ; +oidspec: + boot_ident { $$ = atooid(LexIDStr($1)); } + ; + optoideq: - OBJ_ID EQUALS boot_ident { $$ = atol(LexIDStr($3)); } - | { $$ = (Oid) 0; } + OBJ_ID EQUALS oidspec { $$ = $3; } + | { $$ = (Oid) 0; } ; boot_tuplelist: |