summaryrefslogtreecommitdiff
path: root/src/backend/bootstrap/bootparse.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/bootstrap/bootparse.y')
-rw-r--r--src/backend/bootstrap/bootparse.y32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y
index 41d2fd4a5f..de3695c7e0 100644
--- a/src/backend/bootstrap/bootparse.y
+++ b/src/backend/bootstrap/bootparse.y
@@ -4,7 +4,7 @@
* bootparse.y
* yacc grammar for the "bootstrap" mode (BKI file format)
*
- * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -22,7 +22,6 @@
#include "access/htup.h"
#include "access/itup.h"
#include "access/tupdesc.h"
-#include "access/xact.h"
#include "bootstrap/bootstrap.h"
#include "catalog/catalog.h"
#include "catalog/heap.h"
@@ -49,10 +48,9 @@
#include "storage/off.h"
#include "storage/smgr.h"
#include "tcop/dest.h"
+#include "utils/memutils.h"
#include "utils/rel.h"
-#define atooid(x) ((Oid) strtoul((x), NULL, 10))
-
/*
* Bison doesn't allocate anything that needs to live across parser calls,
@@ -65,19 +63,27 @@
#define YYMALLOC palloc
#define YYFREE pfree
+static MemoryContext per_line_ctx = NULL;
+
static void
do_start(void)
{
- StartTransactionCommand();
- elog(DEBUG4, "start transaction");
+ Assert(CurrentMemoryContext == CurTransactionContext);
+ /* First time through, create the per-line working context */
+ if (per_line_ctx == NULL)
+ per_line_ctx = AllocSetContextCreate(CurTransactionContext,
+ "bootstrap per-line processing",
+ ALLOCSET_DEFAULT_SIZES);
+ MemoryContextSwitchTo(per_line_ctx);
}
static void
do_end(void)
{
- CommitTransactionCommand();
- elog(DEBUG4, "commit transaction");
+ /* Reclaim memory allocated while processing this line */
+ MemoryContextSwitchTo(CurTransactionContext);
+ MemoryContextReset(per_line_ctx);
CHECK_FOR_INTERRUPTS(); /* allow SIGINT to kill bootstrap run */
if (isatty(0))
{
@@ -105,11 +111,11 @@ static int num_columns_read = 0;
%type <list> boot_index_params
%type <ielem> boot_index_param
-%type <str> boot_const boot_ident
+%type <str> boot_ident
%type <ival> optbootstrap optsharedrelation optwithoutoids boot_column_nullness
%type <oidval> oidspec optoideq optrowtypeoid
-%token <str> CONST_P ID
+%token <str> ID
%token OPEN XCLOSE XCREATE INSERT_TUPLE
%token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE XTOAST
%token COMMA EQUALS LPAREN RPAREN
@@ -464,16 +470,10 @@ boot_column_val_list:
boot_column_val:
boot_ident
{ InsertOneValue($1, num_columns_read++); }
- | boot_const
- { InsertOneValue($1, num_columns_read++); }
| NULLVAL
{ InsertOneNull(num_columns_read++); }
;
-boot_const :
- CONST_P { $$ = yylval.str; }
- ;
-
boot_ident :
ID { $$ = yylval.str; }
;