From 6e38e34d64b5769272e0ab873416aa6c95509b50 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 31 Jul 2006 01:16:38 +0000 Subject: 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. --- src/backend/bootstrap/bootparse.y | 16 ++++++++++++++-- src/backend/bootstrap/bootscanner.l | 3 ++- src/backend/bootstrap/bootstrap.c | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src/backend/bootstrap') diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 9bb8f01b1e..b25ea11a0b 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.82 2006/07/03 22:45:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.83 2006/07/31 01:16:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -33,6 +33,7 @@ #include "catalog/pg_class.h" #include "catalog/pg_namespace.h" #include "catalog/pg_tablespace.h" +#include "catalog/toasting.h" #include "commands/defrem.h" #include "miscadmin.h" #include "nodes/makefuncs.h" @@ -99,7 +100,7 @@ int num_columns_read = 0; %token CONST_P ID %token OPEN XCLOSE XCREATE INSERT_TUPLE -%token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE +%token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE XTOAST %token COMMA EQUALS LPAREN RPAREN %token OBJ_ID XBOOTSTRAP XSHARED_RELATION XWITHOUT_OIDS NULLVAL %start TopLevel @@ -126,6 +127,7 @@ Boot_Query : | Boot_InsertStmt | Boot_DeclareIndexStmt | Boot_DeclareUniqueIndexStmt + | Boot_DeclareToastStmt | Boot_BuildIndsStmt ; @@ -278,6 +280,16 @@ Boot_DeclareUniqueIndexStmt: } ; +Boot_DeclareToastStmt: + XDECLARE XTOAST oidspec oidspec ON boot_ident + { + do_start(); + + BootstrapToastTable(LexIDStr($6), $3, $4); + do_end(); + } + ; + Boot_BuildIndsStmt: XBUILD INDICES { diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l index f75d79a8d0..b5ed234a16 100644 --- a/src/backend/bootstrap/bootscanner.l +++ b/src/backend/bootstrap/bootscanner.l @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.42 2006/03/07 01:03:12 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.43 2006/07/31 01:16:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -99,6 +99,7 @@ insert { return(INSERT_TUPLE); } "index" { return(INDEX); } "on" { return(ON); } "using" { return(USING); } +"toast" { return(XTOAST); } {arrayid} { yylval.ival = EnterString(MapArrayTypeName((char*)yytext)); diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 150c29db3f..9399b6d052 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 - * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.221 2006/07/29 03:02:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.222 2006/07/31 01:16:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1242,7 +1242,7 @@ build_indices(void) heap = heap_open(ILHead->il_heap, NoLock); ind = index_open(ILHead->il_ind); - index_build(heap, ind, ILHead->il_info, false, false); + index_build(heap, ind, ILHead->il_info, false); index_close(ind); heap_close(heap, NoLock); -- cgit v1.2.1