mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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.
This commit is contained in:
@ -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 <ival> 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
|
||||
{
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user