summaryrefslogtreecommitdiff
path: root/src/backend/bootstrap
diff options
context:
space:
mode:
authorHiroshi Inoue <inoue@tpf.co.jp>1999-11-04 08:01:09 +0000
committerHiroshi Inoue <inoue@tpf.co.jp>1999-11-04 08:01:09 +0000
commit2e2189a568e551e97180a8575bdbe320b3947b34 (patch)
tree0932a058fad004c0d5b699e15d0d1f66a01be52f /src/backend/bootstrap
parenta2c834f709e6841a1eef360f40448167b6f58208 (diff)
Make it possible to execute crashed CREATE/DROP commands again.
Now indexes of pg_class and pg_type are unique indexes and guarantee the uniqueness of correponding attributes. heap_create() was changed to take another boolean parameter which allows to postpone the creation of disk file. The name of rd_nonameunlinked was changed to rd_unlinked. It is used generally(not only for noname relations) now. Requires initdb.
Diffstat (limited to 'src/backend/bootstrap')
-rw-r--r--src/backend/bootstrap/bootparse.y20
-rw-r--r--src/backend/bootstrap/bootscanner.l3
2 files changed, 19 insertions, 4 deletions
diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y
index ce2d7d496ec..2ad7a7cfc73 100644
--- a/src/backend/bootstrap/bootparse.y
+++ b/src/backend/bootstrap/bootparse.y
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.27 1999/07/17 20:16:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.28 1999/11/04 08:00:58 inoue Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,7 +80,7 @@ static Oid objectid;
%token <ival> CONST ID
%token OPEN XCLOSE XCREATE INSERT_TUPLE
%token STRING XDEFINE
-%token XDECLARE INDEX ON USING XBUILD INDICES
+%token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE
%token COMMA EQUALS LPAREN RPAREN
%token OBJ_ID XBOOTSTRAP NULLVAL
%start TopLevel
@@ -106,6 +106,7 @@ Boot_Query :
| Boot_CreateStmt
| Boot_InsertStmt
| Boot_DeclareIndexStmt
+ | Boot_DeclareUniqueIndexStmt
| Boot_BuildIndsStmt
;
@@ -164,7 +165,7 @@ Boot_CreateStmt:
puts("creating bootstrap relation");
tupdesc = CreateTupleDesc(numattr,attrtypes);
reldesc = heap_create(LexIDStr($3), tupdesc,
- false, false);
+ false, false, true);
if (DebugMode)
puts("bootstrap relation created ok");
}
@@ -230,6 +231,19 @@ Boot_DeclareIndexStmt:
}
;
+Boot_DeclareUniqueIndexStmt:
+ XDECLARE UNIQUE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN
+ {
+ DO_START;
+
+ DefineIndex(LexIDStr($6),
+ LexIDStr($4),
+ LexIDStr($8),
+ $10, NIL, 1, 0, 0, NIL);
+ DO_END;
+ }
+ ;
+
Boot_BuildIndsStmt:
XBUILD INDICES { build_indices(); }
diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l
index a7254994ec8..0c1e0fb7d88 100644
--- a/src/backend/bootstrap/bootscanner.l
+++ b/src/backend/bootstrap/bootscanner.l
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.15 1999/09/11 22:26:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.16 1999/11/04 08:00:58 inoue Exp $
*
*-------------------------------------------------------------------------
*/
@@ -90,6 +90,7 @@ insert { return(INSERT_TUPLE); }
"declare" { return(XDECLARE); }
"build" { return(XBUILD); }
"indices" { return(INDICES); }
+"unique" { return(UNIQUE); }
"index" { return(INDEX); }
"on" { return(ON); }
"using" { return(USING); }