diff options
| author | Tom Lane | 2001-08-10 18:57:42 +0000 |
|---|---|---|
| committer | Tom Lane | 2001-08-10 18:57:42 +0000 |
| commit | bf56f0759bdfa87f143c3abd09f893a5f530fe88 (patch) | |
| tree | 10555a5e46bcfdfd9799b8f0e13ab48101d766de /src/backend/bootstrap | |
| parent | d062f0f4e91f68b1f55b04691bd92d1efc83dc54 (diff) | |
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.
Diffstat (limited to 'src/backend/bootstrap')
| -rw-r--r-- | src/backend/bootstrap/bootparse.y | 39 | ||||
| -rw-r--r-- | src/backend/bootstrap/bootscanner.l | 4 | ||||
| -rw-r--r-- | src/backend/bootstrap/bootstrap.c | 9 |
3 files changed, 31 insertions, 21 deletions
diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 1e4f1ace65..28da7541d5 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.36 2001/05/12 01:48:49 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.37 2001/08/10 18:57:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -75,7 +75,6 @@ do_end() int num_columns_read = 0; -static Oid objectid; %} @@ -91,7 +90,7 @@ static Oid objectid; %type <list> boot_index_params %type <ielem> boot_index_param %type <ival> boot_const boot_ident -%type <ival> optbootstrap boot_tuple boot_tuplelist +%type <ival> optbootstrap optwithoutoids boot_tuple boot_tuplelist %type <oidval> optoideq %token <ival> CONST ID @@ -99,7 +98,7 @@ static Oid objectid; %token STRING XDEFINE %token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE %token COMMA EQUALS LPAREN RPAREN -%token OBJ_ID XBOOTSTRAP NULLVAL +%token OBJ_ID XBOOTSTRAP XWITHOUT_OIDS NULLVAL %start TopLevel %nonassoc low @@ -152,7 +151,7 @@ Boot_CloseStmt: ; Boot_CreateStmt: - XCREATE optbootstrap boot_ident LPAREN + XCREATE optbootstrap optwithoutoids boot_ident LPAREN { do_start(); numattr = 0; @@ -160,10 +159,10 @@ Boot_CreateStmt: { if ($2) elog(DEBUG, "creating bootstrap relation %s...", - LexIDStr($3)); + LexIDStr($4)); else elog(DEBUG, "creating relation %s...", - LexIDStr($3)); + LexIDStr($4)); } } boot_typelist @@ -185,9 +184,10 @@ Boot_CreateStmt: closerel(NULL); } - tupdesc = CreateTupleDesc(numattr,attrtypes); - reldesc = heap_create(LexIDStr($3), tupdesc, + tupdesc = CreateTupleDesc(numattr, attrtypes); + reldesc = heap_create(LexIDStr($4), tupdesc, false, true, true); + reldesc->rd_rel->relhasoids = ! ($3); if (DebugMode) elog(DEBUG, "bootstrap relation created"); } @@ -197,9 +197,10 @@ Boot_CreateStmt: TupleDesc tupdesc; tupdesc = CreateTupleDesc(numattr,attrtypes); - id = heap_create_with_catalog(LexIDStr($3), + id = heap_create_with_catalog(LexIDStr($4), tupdesc, RELKIND_RELATION, + ! ($3), false, true); if (DebugMode) @@ -232,8 +233,7 @@ Boot_InsertStmt: elog(ERROR, "relation not open"); err_out(); } - objectid = $2; - InsertOneTuple(objectid); + InsertOneTuple($2); do_end(); } ; @@ -287,6 +287,11 @@ optbootstrap: | { $$ = 0; } ; +optwithoutoids: + XWITHOUT_OIDS { $$ = 1; } + | { $$ = 0; } + ; + boot_typelist: boot_type_thing | boot_typelist COMMA boot_type_thing @@ -302,8 +307,8 @@ boot_type_thing: ; optoideq: - OBJ_ID EQUALS boot_ident { $$ = atol(LexIDStr($3)); } - | { $$ = newoid(); } + OBJ_ID EQUALS boot_ident { $$ = atol(LexIDStr($3)); } + | { $$ = (Oid) 0; } ; boot_tuplelist: @@ -313,8 +318,10 @@ boot_tuplelist: ; boot_tuple: - boot_ident {InsertOneValue(objectid, LexIDStr($1), num_columns_read++); } - | boot_const {InsertOneValue(objectid, LexIDStr($1), num_columns_read++); } + boot_ident + { InsertOneValue(LexIDStr($1), num_columns_read++); } + | boot_const + { InsertOneValue(LexIDStr($1), num_columns_read++); } | NULLVAL { InsertOneNull(num_columns_read++); } ; diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l index 992b970116..47f0c8c131 100644 --- a/src/backend/bootstrap/bootscanner.l +++ b/src/backend/bootstrap/bootscanner.l @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.20 2001/05/12 01:48:49 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.21 2001/08/10 18:57:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -94,6 +94,8 @@ insert { return(INSERT_TUPLE); } "index" { return(INDEX); } "on" { return(ON); } "using" { return(USING); } +"without_oids" { return(XWITHOUT_OIDS); } + {arrayid} { yylval.ival = EnterString(MapArrayTypeName((char*)yytext)); return(ID); diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 5600921709..1bb561f40c 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.113 2001/08/04 00:14:43 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.114 2001/08/10 18:57:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -627,7 +627,9 @@ DefineAttr(char *name, char *type, int attnum) /* ---------------- * InsertOneTuple - * assumes that 'oid' will not be zero. + * + * If objectid is not zero, it is a specific OID to assign to the tuple. + * Otherwise, an OID will be assigned (if necessary) by heap_insert. * ---------------- */ void @@ -635,7 +637,6 @@ InsertOneTuple(Oid objectid) { HeapTuple tuple; TupleDesc tupDesc; - int i; if (DebugMode) @@ -664,7 +665,7 @@ InsertOneTuple(Oid objectid) * ---------------- */ void -InsertOneValue(Oid objectid, char *value, int i) +InsertOneValue(char *value, int i) { int typeindex; char *prt; |
