Make bootstrap debug messages more readable. Clean up some clutter.
This commit is contained in:
parent
c51b00a213
commit
2e1579a99f
@ -9,15 +9,15 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.35 2001/01/24 19:42:51 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.36 2001/05/12 01:48:49 petere Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "access/attnum.h"
|
#include "access/attnum.h"
|
||||||
#include "access/htup.h"
|
#include "access/htup.h"
|
||||||
@ -50,17 +50,31 @@
|
|||||||
#include "utils/nabstime.h"
|
#include "utils/nabstime.h"
|
||||||
#include "utils/rel.h"
|
#include "utils/rel.h"
|
||||||
|
|
||||||
#define DO_START { \
|
|
||||||
StartTransactionCommand();\
|
static void
|
||||||
|
do_start()
|
||||||
|
{
|
||||||
|
StartTransactionCommand();
|
||||||
|
if (DebugMode)
|
||||||
|
elog(DEBUG, "start transaction");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DO_END { \
|
|
||||||
CommitTransactionCommand();\
|
static void
|
||||||
if (!Quiet) { EMITPROMPT; }\
|
do_end()
|
||||||
fflush(stdout); \
|
{
|
||||||
|
CommitTransactionCommand();
|
||||||
|
if (DebugMode)
|
||||||
|
elog(DEBUG, "commit transaction");
|
||||||
|
if (isatty(0))
|
||||||
|
{
|
||||||
|
printf("bootstrap> ");
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int num_tuples_read = 0;
|
|
||||||
|
int num_columns_read = 0;
|
||||||
static Oid objectid;
|
static Oid objectid;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
@ -71,12 +85,14 @@ static Oid objectid;
|
|||||||
IndexElem *ielem;
|
IndexElem *ielem;
|
||||||
char *str;
|
char *str;
|
||||||
int ival;
|
int ival;
|
||||||
|
Oid oidval;
|
||||||
}
|
}
|
||||||
|
|
||||||
%type <list> boot_index_params
|
%type <list> boot_index_params
|
||||||
%type <ielem> boot_index_param
|
%type <ielem> boot_index_param
|
||||||
%type <ival> boot_const boot_ident
|
%type <ival> boot_const boot_ident
|
||||||
%type <ival> optbootstrap optoideq boot_tuple boot_tuplelist
|
%type <ival> optbootstrap boot_tuple boot_tuplelist
|
||||||
|
%type <oidval> optoideq
|
||||||
|
|
||||||
%token <ival> CONST ID
|
%token <ival> CONST ID
|
||||||
%token OPEN XCLOSE XCREATE INSERT_TUPLE
|
%token OPEN XCLOSE XCREATE INSERT_TUPLE
|
||||||
@ -114,42 +130,49 @@ Boot_Query :
|
|||||||
Boot_OpenStmt:
|
Boot_OpenStmt:
|
||||||
OPEN boot_ident
|
OPEN boot_ident
|
||||||
{
|
{
|
||||||
DO_START;
|
do_start();
|
||||||
boot_openrel(LexIDStr($2));
|
boot_openrel(LexIDStr($2));
|
||||||
DO_END;
|
do_end();
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
Boot_CloseStmt:
|
Boot_CloseStmt:
|
||||||
XCLOSE boot_ident %prec low
|
XCLOSE boot_ident %prec low
|
||||||
{
|
{
|
||||||
DO_START;
|
do_start();
|
||||||
closerel(LexIDStr($2));
|
closerel(LexIDStr($2));
|
||||||
DO_END;
|
do_end();
|
||||||
}
|
}
|
||||||
| XCLOSE %prec high
|
| XCLOSE %prec high
|
||||||
{
|
{
|
||||||
DO_START;
|
do_start();
|
||||||
closerel(NULL);
|
closerel(NULL);
|
||||||
DO_END;
|
do_end();
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
Boot_CreateStmt:
|
Boot_CreateStmt:
|
||||||
XCREATE optbootstrap boot_ident LPAREN
|
XCREATE optbootstrap boot_ident LPAREN
|
||||||
{
|
{
|
||||||
DO_START;
|
do_start();
|
||||||
numattr=(int)0;
|
numattr = 0;
|
||||||
|
if (DebugMode)
|
||||||
|
{
|
||||||
|
if ($2)
|
||||||
|
elog(DEBUG, "creating bootstrap relation %s...",
|
||||||
|
LexIDStr($3));
|
||||||
|
else
|
||||||
|
elog(DEBUG, "creating relation %s...",
|
||||||
|
LexIDStr($3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
boot_typelist
|
boot_typelist
|
||||||
{
|
{
|
||||||
if (!Quiet)
|
do_end();
|
||||||
putchar('\n');
|
|
||||||
DO_END;
|
|
||||||
}
|
}
|
||||||
RPAREN
|
RPAREN
|
||||||
{
|
{
|
||||||
DO_START;
|
do_start();
|
||||||
|
|
||||||
if ($2)
|
if ($2)
|
||||||
{
|
{
|
||||||
@ -158,17 +181,15 @@ Boot_CreateStmt:
|
|||||||
|
|
||||||
if (reldesc)
|
if (reldesc)
|
||||||
{
|
{
|
||||||
puts("create bootstrap: Warning, open relation");
|
elog(DEBUG, "create bootstrap: warning, open relation exists, closing first");
|
||||||
puts("exists, closing first");
|
|
||||||
closerel(NULL);
|
closerel(NULL);
|
||||||
}
|
}
|
||||||
if (DebugMode)
|
|
||||||
puts("creating bootstrap relation");
|
|
||||||
tupdesc = CreateTupleDesc(numattr,attrtypes);
|
tupdesc = CreateTupleDesc(numattr,attrtypes);
|
||||||
reldesc = heap_create(LexIDStr($3), tupdesc,
|
reldesc = heap_create(LexIDStr($3), tupdesc,
|
||||||
false, true, true);
|
false, true, true);
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
puts("bootstrap relation created ok");
|
elog(DEBUG, "bootstrap relation created");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -181,70 +202,65 @@ Boot_CreateStmt:
|
|||||||
RELKIND_RELATION,
|
RELKIND_RELATION,
|
||||||
false,
|
false,
|
||||||
true);
|
true);
|
||||||
if (!Quiet)
|
|
||||||
printf("CREATED relation %s with OID %u\n",
|
|
||||||
LexIDStr($3), id);
|
|
||||||
}
|
|
||||||
DO_END;
|
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
puts("Commit End");
|
elog(DEBUG, "relation created with oid %u", id);
|
||||||
|
}
|
||||||
|
do_end();
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
Boot_InsertStmt:
|
Boot_InsertStmt:
|
||||||
INSERT_TUPLE optoideq
|
INSERT_TUPLE optoideq
|
||||||
{
|
{
|
||||||
DO_START;
|
do_start();
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
printf("tuple %d<", $2);
|
{
|
||||||
num_tuples_read = 0;
|
if ($2)
|
||||||
|
elog(DEBUG, "inserting row with oid %u...", $2);
|
||||||
|
else
|
||||||
|
elog(DEBUG, "inserting row...");
|
||||||
|
}
|
||||||
|
num_columns_read = 0;
|
||||||
}
|
}
|
||||||
LPAREN boot_tuplelist RPAREN
|
LPAREN boot_tuplelist RPAREN
|
||||||
{
|
{
|
||||||
if (num_tuples_read != numattr)
|
if (num_columns_read != numattr)
|
||||||
elog(ERROR,"incorrect number of values for tuple");
|
elog(ERROR, "incorrect number of columns in row (expected %d, got %d)",
|
||||||
|
numattr, num_columns_read);
|
||||||
if (reldesc == (Relation)NULL)
|
if (reldesc == (Relation)NULL)
|
||||||
{
|
{
|
||||||
elog(ERROR,"must OPEN RELATION before INSERT\n");
|
elog(ERROR, "relation not open");
|
||||||
err_out();
|
err_out();
|
||||||
}
|
}
|
||||||
if (DebugMode)
|
|
||||||
puts("Insert Begin");
|
|
||||||
objectid = $2;
|
objectid = $2;
|
||||||
InsertOneTuple(objectid);
|
InsertOneTuple(objectid);
|
||||||
if (DebugMode)
|
do_end();
|
||||||
puts("Insert End");
|
|
||||||
if (!Quiet)
|
|
||||||
putchar('\n');
|
|
||||||
DO_END;
|
|
||||||
if (DebugMode)
|
|
||||||
puts("Transaction End");
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
Boot_DeclareIndexStmt:
|
Boot_DeclareIndexStmt:
|
||||||
XDECLARE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN
|
XDECLARE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN
|
||||||
{
|
{
|
||||||
DO_START;
|
do_start();
|
||||||
|
|
||||||
DefineIndex(LexIDStr($5),
|
DefineIndex(LexIDStr($5),
|
||||||
LexIDStr($3),
|
LexIDStr($3),
|
||||||
LexIDStr($7),
|
LexIDStr($7),
|
||||||
$9, NIL, 0, 0, 0, NIL);
|
$9, NIL, 0, 0, 0, NIL);
|
||||||
DO_END;
|
do_end();
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
Boot_DeclareUniqueIndexStmt:
|
Boot_DeclareUniqueIndexStmt:
|
||||||
XDECLARE UNIQUE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN
|
XDECLARE UNIQUE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN
|
||||||
{
|
{
|
||||||
DO_START;
|
do_start();
|
||||||
|
|
||||||
DefineIndex(LexIDStr($6),
|
DefineIndex(LexIDStr($6),
|
||||||
LexIDStr($4),
|
LexIDStr($4),
|
||||||
LexIDStr($8),
|
LexIDStr($8),
|
||||||
$10, NIL, 1, 0, 0, NIL);
|
$10, NIL, 1, 0, 0, NIL);
|
||||||
DO_END;
|
do_end();
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -280,10 +296,8 @@ boot_type_thing:
|
|||||||
boot_ident EQUALS boot_ident
|
boot_ident EQUALS boot_ident
|
||||||
{
|
{
|
||||||
if(++numattr > MAXATTR)
|
if(++numattr > MAXATTR)
|
||||||
elog(FATAL,"Too many attributes\n");
|
elog(FATAL, "too many columns");
|
||||||
DefineAttr(LexIDStr($1),LexIDStr($3),numattr-1);
|
DefineAttr(LexIDStr($1),LexIDStr($3),numattr-1);
|
||||||
if (DebugMode)
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -299,10 +313,10 @@ boot_tuplelist:
|
|||||||
;
|
;
|
||||||
|
|
||||||
boot_tuple:
|
boot_tuple:
|
||||||
boot_ident {InsertOneValue(objectid, LexIDStr($1), num_tuples_read++); }
|
boot_ident {InsertOneValue(objectid, LexIDStr($1), num_columns_read++); }
|
||||||
| boot_const {InsertOneValue(objectid, LexIDStr($1), num_tuples_read++); }
|
| boot_const {InsertOneValue(objectid, LexIDStr($1), num_columns_read++); }
|
||||||
| NULLVAL
|
| NULLVAL
|
||||||
{ InsertOneNull(num_tuples_read++); }
|
{ InsertOneNull(num_columns_read++); }
|
||||||
;
|
;
|
||||||
|
|
||||||
boot_const :
|
boot_const :
|
||||||
|
@ -9,14 +9,14 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.19 2001/01/24 19:42:51 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.20 2001/05/12 01:48:49 petere Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "access/attnum.h"
|
#include "access/attnum.h"
|
||||||
#include "access/htup.h"
|
#include "access/htup.h"
|
||||||
#include "access/itup.h"
|
#include "access/itup.h"
|
||||||
@ -122,7 +122,7 @@ insert { return(INSERT_TUPLE); }
|
|||||||
}
|
}
|
||||||
|
|
||||||
. {
|
. {
|
||||||
printf("syntax error %d : -> %s\n", yyline, yytext);
|
elog(ERROR, "syntax error at line %d: unexpected character %s", yyline, yytext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,5 +138,5 @@ yywrap(void)
|
|||||||
void
|
void
|
||||||
yyerror(const char *str)
|
yyerror(const char *str)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"\tsyntax error %d : %s",yyline, str);
|
elog(ERROR, "syntax error at line %d: unexpected token %s", yyline, str);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.106 2001/03/22 06:16:10 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.107 2001/05/12 01:48:49 petere Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -185,13 +185,11 @@ err_out(void)
|
|||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: postgres -boot [-d] [-C] [-F] [-O] [-Q] ");
|
fprintf(stderr, "Usage:\n postgres -boot [-d] [-D datadir] [-F] [-x num] dbname\n");
|
||||||
fprintf(stderr, "[-P portno] [dbName]\n");
|
fprintf(stderr, " -d debug mode\n");
|
||||||
fprintf(stderr, " d: debug mode\n");
|
fprintf(stderr, " -D datadir data directory\n");
|
||||||
fprintf(stderr, " C: disable version checking\n");
|
fprintf(stderr, " -F turn off fsync\n");
|
||||||
fprintf(stderr, " F: turn off fsync\n");
|
fprintf(stderr, " -x num internal use\n");
|
||||||
fprintf(stderr, " O: set BootstrapProcessing mode\n");
|
|
||||||
fprintf(stderr, " P portno: specify port number\n");
|
|
||||||
|
|
||||||
proc_exit(1);
|
proc_exit(1);
|
||||||
}
|
}
|
||||||
@ -240,8 +238,6 @@ BootstrapMain(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Set defaults, to be overriden by explicit options below */
|
/* Set defaults, to be overriden by explicit options below */
|
||||||
Quiet = false;
|
|
||||||
Noversion = false;
|
|
||||||
dbName = NULL;
|
dbName = NULL;
|
||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
@ -250,7 +246,7 @@ BootstrapMain(int argc, char *argv[])
|
|||||||
* variable */
|
* variable */
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((flag = getopt(argc, argv, "D:dCQx:pB:F")) != EOF)
|
while ((flag = getopt(argc, argv, "B:dD:Fpx:")) != EOF)
|
||||||
{
|
{
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
@ -261,15 +257,9 @@ BootstrapMain(int argc, char *argv[])
|
|||||||
DebugMode = true; /* print out debugging info while
|
DebugMode = true; /* print out debugging info while
|
||||||
* parsing */
|
* parsing */
|
||||||
break;
|
break;
|
||||||
case 'C':
|
|
||||||
Noversion = true;
|
|
||||||
break;
|
|
||||||
case 'F':
|
case 'F':
|
||||||
enableFsync = false;
|
enableFsync = false;
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
|
||||||
Quiet = true;
|
|
||||||
break;
|
|
||||||
case 'x':
|
case 'x':
|
||||||
xlogop = atoi(optarg);
|
xlogop = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
@ -285,21 +275,12 @@ BootstrapMain(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
} /* while */
|
} /* while */
|
||||||
|
|
||||||
if (argc - optind > 1)
|
if (argc - optind != 1)
|
||||||
usage();
|
usage();
|
||||||
else if (argc - optind == 1)
|
|
||||||
dbName = argv[optind];
|
dbName = argv[optind];
|
||||||
|
|
||||||
if (dbName == NULL)
|
Assert(dbName);
|
||||||
{
|
|
||||||
dbName = getenv("USER");
|
|
||||||
if (dbName == NULL)
|
|
||||||
{
|
|
||||||
fputs("bootstrap backend: failed, no db name specified\n", stderr);
|
|
||||||
fputs(" and no USER enviroment variable\n", stderr);
|
|
||||||
proc_exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
@ -493,8 +474,8 @@ boot_openrel(char *relname)
|
|||||||
if (reldesc != NULL)
|
if (reldesc != NULL)
|
||||||
closerel(NULL);
|
closerel(NULL);
|
||||||
|
|
||||||
if (!Quiet)
|
if (DebugMode)
|
||||||
printf("Amopen: relation %s. attrsize %d\n", relname ? relname : "(null)",
|
elog(DEBUG, "open relation %s, attrsize %d", relname ? relname : "(null)",
|
||||||
(int) ATTRIBUTE_TUPLE_SIZE);
|
(int) ATTRIBUTE_TUPLE_SIZE);
|
||||||
|
|
||||||
reldesc = heap_openr(relname, NoLock);
|
reldesc = heap_openr(relname, NoLock);
|
||||||
@ -523,11 +504,10 @@ boot_openrel(char *relname)
|
|||||||
{
|
{
|
||||||
Form_pg_attribute at = attrtypes[i];
|
Form_pg_attribute at = attrtypes[i];
|
||||||
|
|
||||||
printf("create attribute %d name %s len %d num %d type %d\n",
|
elog(DEBUG, "create attribute %d name %s len %d num %d type %u",
|
||||||
i, NameStr(at->attname), at->attlen, at->attnum,
|
i, NameStr(at->attname), at->attlen, at->attnum,
|
||||||
at->atttypid
|
at->atttypid
|
||||||
);
|
);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -554,11 +534,11 @@ closerel(char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reldesc == NULL)
|
if (reldesc == NULL)
|
||||||
elog(ERROR, "Warning: no opened relation to close.\n");
|
elog(ERROR, "no open relation to close");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!Quiet)
|
if (DebugMode)
|
||||||
printf("Amclose: relation %s.\n", relname ? relname : "(null)");
|
elog(DEBUG, "close relation %s", relname ? relname : "(null)");
|
||||||
heap_close(reldesc, NoLock);
|
heap_close(reldesc, NoLock);
|
||||||
reldesc = (Relation) NULL;
|
reldesc = (Relation) NULL;
|
||||||
}
|
}
|
||||||
@ -582,7 +562,7 @@ DefineAttr(char *name, char *type, int attnum)
|
|||||||
|
|
||||||
if (reldesc != NULL)
|
if (reldesc != NULL)
|
||||||
{
|
{
|
||||||
fputs("Warning: no open relations allowed with 't' command.\n", stderr);
|
elog(DEBUG, "warning: no open relations allowed with 'create' command");
|
||||||
closerel(relname);
|
closerel(relname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,8 +573,8 @@ DefineAttr(char *name, char *type, int attnum)
|
|||||||
{
|
{
|
||||||
attrtypes[attnum]->atttypid = Ap->am_oid;
|
attrtypes[attnum]->atttypid = Ap->am_oid;
|
||||||
namestrcpy(&attrtypes[attnum]->attname, name);
|
namestrcpy(&attrtypes[attnum]->attname, name);
|
||||||
if (!Quiet)
|
if (DebugMode)
|
||||||
printf("<%s %s> ", NameStr(attrtypes[attnum]->attname), type);
|
elog(DEBUG, "column %s %s", NameStr(attrtypes[attnum]->attname), type);
|
||||||
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
|
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
|
||||||
attlen = attrtypes[attnum]->attlen = Ap->am_typ.typlen;
|
attlen = attrtypes[attnum]->attlen = Ap->am_typ.typlen;
|
||||||
attrtypes[attnum]->attbyval = Ap->am_typ.typbyval;
|
attrtypes[attnum]->attbyval = Ap->am_typ.typbyval;
|
||||||
@ -605,8 +585,8 @@ DefineAttr(char *name, char *type, int attnum)
|
|||||||
{
|
{
|
||||||
attrtypes[attnum]->atttypid = Procid[typeoid].oid;
|
attrtypes[attnum]->atttypid = Procid[typeoid].oid;
|
||||||
namestrcpy(&attrtypes[attnum]->attname, name);
|
namestrcpy(&attrtypes[attnum]->attname, name);
|
||||||
if (!Quiet)
|
if (DebugMode)
|
||||||
printf("<%s %s> ", NameStr(attrtypes[attnum]->attname), type);
|
elog(DEBUG, "column %s %s", NameStr(attrtypes[attnum]->attname), type);
|
||||||
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
|
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
|
||||||
attlen = attrtypes[attnum]->attlen = Procid[typeoid].len;
|
attlen = attrtypes[attnum]->attlen = Procid[typeoid].len;
|
||||||
attrtypes[attnum]->attstorage = 'p';
|
attrtypes[attnum]->attstorage = 'p';
|
||||||
@ -654,10 +634,7 @@ InsertOneTuple(Oid objectid)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
{
|
elog(DEBUG, "inserting row oid %u, %d columns", objectid, numattr);
|
||||||
printf("InsertOneTuple oid %u, %d attrs\n", objectid, numattr);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
tupDesc = CreateTupleDesc(numattr, attrtypes);
|
tupDesc = CreateTupleDesc(numattr, attrtypes);
|
||||||
tuple = heap_formtuple(tupDesc, values, Blanks);
|
tuple = heap_formtuple(tupDesc, values, Blanks);
|
||||||
@ -668,10 +645,7 @@ InsertOneTuple(Oid objectid)
|
|||||||
heap_insert(reldesc, tuple);
|
heap_insert(reldesc, tuple);
|
||||||
heap_freetuple(tuple);
|
heap_freetuple(tuple);
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
{
|
elog(DEBUG, "row inserted");
|
||||||
printf("End InsertOneTuple, objectid=%u\n", objectid);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset blanks for next tuple
|
* Reset blanks for next tuple
|
||||||
@ -691,30 +665,25 @@ InsertOneValue(Oid objectid, char *value, int i)
|
|||||||
char *prt;
|
char *prt;
|
||||||
struct typmap **app;
|
struct typmap **app;
|
||||||
|
|
||||||
|
AssertArg(i >= 0 || i < MAXATTR);
|
||||||
|
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
printf("Inserting value: '%s'\n", value);
|
elog(DEBUG, "inserting column %d value '%s'", i, value);
|
||||||
if (i < 0 || i >= MAXATTR)
|
|
||||||
{
|
|
||||||
printf("i out of range: %d\n", i);
|
|
||||||
Assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Typ != (struct typmap **) NULL)
|
if (Typ != (struct typmap **) NULL)
|
||||||
{
|
{
|
||||||
struct typmap *ap;
|
struct typmap *ap;
|
||||||
|
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
puts("Typ != NULL");
|
elog(DEBUG, "Typ != NULL");
|
||||||
app = Typ;
|
app = Typ;
|
||||||
while (*app && (*app)->am_oid != reldesc->rd_att->attrs[i]->atttypid)
|
while (*app && (*app)->am_oid != reldesc->rd_att->attrs[i]->atttypid)
|
||||||
++app;
|
++app;
|
||||||
ap = *app;
|
ap = *app;
|
||||||
if (ap == NULL)
|
if (ap == NULL)
|
||||||
{
|
{
|
||||||
printf("Unable to find atttypid in Typ list! %u\n",
|
elog(FATAL, "unable to find atttypid %u in Typ list",
|
||||||
reldesc->rd_att->attrs[i]->atttypid
|
reldesc->rd_att->attrs[i]->atttypid);
|
||||||
);
|
|
||||||
Assert(0);
|
|
||||||
}
|
}
|
||||||
values[i] = OidFunctionCall3(ap->am_typ.typinput,
|
values[i] = OidFunctionCall3(ap->am_typ.typinput,
|
||||||
CStringGetDatum(value),
|
CStringGetDatum(value),
|
||||||
@ -724,8 +693,8 @@ InsertOneValue(Oid objectid, char *value, int i)
|
|||||||
values[i],
|
values[i],
|
||||||
ObjectIdGetDatum(ap->am_typ.typelem),
|
ObjectIdGetDatum(ap->am_typ.typelem),
|
||||||
Int32GetDatum(-1)));
|
Int32GetDatum(-1)));
|
||||||
if (!Quiet)
|
if (DebugMode)
|
||||||
printf("%s ", prt);
|
elog(DEBUG, " -> %s", prt);
|
||||||
pfree(prt);
|
pfree(prt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -736,9 +705,9 @@ InsertOneValue(Oid objectid, char *value, int i)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (typeindex >= n_types)
|
if (typeindex >= n_types)
|
||||||
elog(ERROR, "can't find type OID %u", attrtypes[i]->atttypid);
|
elog(ERROR, "type oid %u not found", attrtypes[i]->atttypid);
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
printf("Typ == NULL, typeindex = %u idx = %d\n", typeindex, i);
|
elog(DEBUG, "Typ == NULL, typeindex = %u", typeindex);
|
||||||
values[i] = OidFunctionCall3(Procid[typeindex].inproc,
|
values[i] = OidFunctionCall3(Procid[typeindex].inproc,
|
||||||
CStringGetDatum(value),
|
CStringGetDatum(value),
|
||||||
ObjectIdGetDatum(Procid[typeindex].elem),
|
ObjectIdGetDatum(Procid[typeindex].elem),
|
||||||
@ -747,15 +716,12 @@ InsertOneValue(Oid objectid, char *value, int i)
|
|||||||
values[i],
|
values[i],
|
||||||
ObjectIdGetDatum(Procid[typeindex].elem),
|
ObjectIdGetDatum(Procid[typeindex].elem),
|
||||||
Int32GetDatum(-1)));
|
Int32GetDatum(-1)));
|
||||||
if (!Quiet)
|
if (DebugMode)
|
||||||
printf("%s ", prt);
|
elog(DEBUG, " -> %s", prt);
|
||||||
pfree(prt);
|
pfree(prt);
|
||||||
}
|
}
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
{
|
elog(DEBUG, "inserted");
|
||||||
puts("End InsertValue");
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
@ -766,9 +732,8 @@ void
|
|||||||
InsertOneNull(int i)
|
InsertOneNull(int i)
|
||||||
{
|
{
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
printf("Inserting null\n");
|
elog(DEBUG, "inserting column %d NULL", i);
|
||||||
if (i < 0 || i >= MAXATTR)
|
Assert(i >= 0 || i < MAXATTR);
|
||||||
elog(FATAL, "i out of range (too many attrs): %d\n", i);
|
|
||||||
values[i] = PointerGetDatum(NULL);
|
values[i] = PointerGetDatum(NULL);
|
||||||
Blanks[i] = 'n';
|
Blanks[i] = 'n';
|
||||||
}
|
}
|
||||||
@ -855,7 +820,7 @@ gettype(char *type)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
printf("bootstrap.c: External Type: %s\n", type);
|
elog(DEBUG, "external type: %s", type);
|
||||||
rel = heap_openr(TypeRelationName, NoLock);
|
rel = heap_openr(TypeRelationName, NoLock);
|
||||||
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
|
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.55 2001/03/22 03:59:59 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.56 2001/05/12 01:48:49 petere Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Globals used all over the place should be declared here and not
|
* Globals used all over the place should be declared here and not
|
||||||
@ -33,7 +33,6 @@
|
|||||||
ProtocolVersion FrontendProtocol = PG_PROTOCOL_LATEST;
|
ProtocolVersion FrontendProtocol = PG_PROTOCOL_LATEST;
|
||||||
|
|
||||||
bool Noversion = false;
|
bool Noversion = false;
|
||||||
bool Quiet = false;
|
|
||||||
|
|
||||||
volatile bool InterruptPending = false;
|
volatile bool InterruptPending = false;
|
||||||
volatile bool QueryCancelPending = false;
|
volatile bool QueryCancelPending = false;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
# Portions Copyright (c) 1994, Regents of the University of California
|
# Portions Copyright (c) 1994, Regents of the University of California
|
||||||
#
|
#
|
||||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.124 2001/05/08 16:28:46 momjian Exp $
|
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.125 2001/05/12 01:48:49 petere Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -453,12 +453,10 @@ mkdir "$PGDATA"/base/1 || exit_nicely
|
|||||||
if [ "$debug" = yes ]
|
if [ "$debug" = yes ]
|
||||||
then
|
then
|
||||||
BACKEND_TALK_ARG="-d"
|
BACKEND_TALK_ARG="-d"
|
||||||
else
|
|
||||||
BACKEND_TALK_ARG="-Q"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BACKENDARGS="-boot -C -F -D$PGDATA $BACKEND_TALK_ARG"
|
BACKENDARGS="-boot -F -D$PGDATA $BACKEND_TALK_ARG"
|
||||||
FIRSTRUN="-boot -x1 -C -F -D$PGDATA $BACKEND_TALK_ARG"
|
FIRSTRUN="-boot -x1 -F -D$PGDATA $BACKEND_TALK_ARG"
|
||||||
|
|
||||||
echo "Creating template1 database in $PGDATA/base/1"
|
echo "Creating template1 database in $PGDATA/base/1"
|
||||||
[ "$debug" = yes ] && echo "Running: $PGPATH/postgres $FIRSTRUN template1"
|
[ "$debug" = yes ] && echo "Running: $PGPATH/postgres $FIRSTRUN template1"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: bootstrap.h,v 1.21 2001/01/24 19:43:20 momjian Exp $
|
* $Id: bootstrap.h,v 1.22 2001/05/12 01:48:49 petere Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -18,8 +18,9 @@
|
|||||||
#include "nodes/execnodes.h"
|
#include "nodes/execnodes.h"
|
||||||
#include "utils/rel.h"
|
#include "utils/rel.h"
|
||||||
|
|
||||||
/* MAXATTR is the maximum number of attributes in a relation supported
|
/*
|
||||||
* at bootstrap time (ie, the max possible in a system table).
|
* MAXATTR is the maximum number of attributes in a relation supported
|
||||||
|
* at bootstrap time (i.e., the max possible in a system table).
|
||||||
*/
|
*/
|
||||||
#define MAXATTR 40
|
#define MAXATTR 40
|
||||||
|
|
||||||
@ -29,7 +30,6 @@ typedef struct hashnode
|
|||||||
struct hashnode *next;
|
struct hashnode *next;
|
||||||
} hashnode;
|
} hashnode;
|
||||||
|
|
||||||
#define EMITPROMPT printf("> ")
|
|
||||||
|
|
||||||
extern Relation reldesc;
|
extern Relation reldesc;
|
||||||
extern Form_pg_attribute attrtypes[MAXATTR];
|
extern Form_pg_attribute attrtypes[MAXATTR];
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: miscadmin.h,v 1.84 2001/05/08 21:06:43 petere Exp $
|
* $Id: miscadmin.h,v 1.85 2001/05/12 01:48:49 petere Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* some of the information in this file should be moved to
|
* some of the information in this file should be moved to
|
||||||
@ -113,7 +113,6 @@ extern int PostmasterMain(int argc, char *argv[]);
|
|||||||
* from utils/init/globals.c
|
* from utils/init/globals.c
|
||||||
*/
|
*/
|
||||||
extern bool Noversion;
|
extern bool Noversion;
|
||||||
extern bool Quiet;
|
|
||||||
extern char *DataDir;
|
extern char *DataDir;
|
||||||
|
|
||||||
extern int MyProcPid;
|
extern int MyProcPid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user