From 469cb65aca0307506886158be2fce9f4438f8361 Mon Sep 17 00:00:00 2001 From: Jan Wieck Date: Tue, 11 Jun 2002 13:40:53 +0000 Subject: [PATCH] Katherine Ward wrote: > Changes to avoid collisions with WIN32 & MFC names... > 1. Renamed: > a. PROC => PGPROC > b. GetUserName() => GetUserNameFromId() > c. GetCurrentTime() => GetCurrentDateTime() > d. IGNORE => IGNORE_DTF in include/utils/datetime.h & utils/adt/datetim > > 2. Added _P to some lex/yacc tokens: > CONST, CHAR, DELETE, FLOAT, GROUP, IN, OUT Jan --- src/backend/access/transam/transam.c | 4 +- src/backend/access/transam/varsup.c | 12 ++-- src/backend/access/transam/xact.c | 10 +-- src/backend/access/transam/xlog.c | 6 +- src/backend/bootstrap/bootparse.y | 6 +- src/backend/bootstrap/bootscanner.l | 4 +- src/backend/commands/schemacmds.c | 6 +- src/backend/commands/user.c | 4 +- src/backend/commands/variable.c | 4 +- src/backend/parser/gram.y | 78 ++++++++++---------- src/backend/parser/keywords.c | 14 ++-- src/backend/postmaster/postmaster.c | 4 +- src/backend/storage/ipc/sinval.c | 28 ++++---- src/backend/storage/lmgr/deadlock.c | 70 +++++++++--------- src/backend/storage/lmgr/lock.c | 18 ++--- src/backend/storage/lmgr/lwlock.c | 22 +++--- src/backend/storage/lmgr/proc.c | 70 +++++++++--------- src/backend/utils/adt/date.c | 6 +- src/backend/utils/adt/datetime.c | 38 +++++----- src/backend/utils/adt/nabstime.c | 6 +- src/backend/utils/adt/name.c | 6 +- src/backend/utils/init/miscinit.c | 4 +- src/backend/utils/init/postinit.c | 6 +- src/include/miscadmin.h | 4 +- src/include/storage/lock.h | 28 ++++---- src/include/storage/proc.h | 22 +++--- src/include/storage/sinval.h | 6 +- src/include/storage/sinvaladt.h | 4 +- src/include/utils/datetime.h | 6 +- src/include/utils/exc.h | 4 +- src/interfaces/ecpg/preproc/c_keywords.c | 4 +- src/interfaces/ecpg/preproc/keywords.c | 14 ++-- src/interfaces/ecpg/preproc/preproc.y | 90 ++++++++++++------------ src/interfaces/libpq/fe-auth.c | 4 +- 34 files changed, 306 insertions(+), 306 deletions(-) diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index 34a13d3ae6..4e83ca7937 100644 --- a/src/backend/access/transam/transam.c +++ b/src/backend/access/transam/transam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.51 2002/05/25 20:00:11 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.52 2002/06/11 13:40:50 wieck Exp $ * * NOTES * This file contains the high level access-method interface to the @@ -201,7 +201,7 @@ TransactionIdDidAbort(TransactionId transactionId) /* * Now this func in shmem.c and gives quality answer by scanning - * PROC structures of all running backend. - vadim 11/26/96 + * PGPROC structures of all running backend. - vadim 11/26/96 * * Old comments: * true if given transaction has neither committed nor aborted diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 80618e3de1..4b8e76085b 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -6,7 +6,7 @@ * Copyright (c) 2000, PostgreSQL Global Development Group * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.49 2002/05/25 20:00:11 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.50 2002/06/11 13:40:50 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -61,23 +61,23 @@ GetNewTransactionId(void) * Must set MyProc->xid before releasing XidGenLock. This ensures * that when GetSnapshotData calls ReadNewTransactionId, all active * XIDs before the returned value of nextXid are already present in - * the shared PROC array. Else we have a race condition. + * the shared PGPROC array. Else we have a race condition. * * XXX by storing xid into MyProc without acquiring SInvalLock, we are * relying on fetch/store of an xid to be atomic, else other backends * might see a partially-set xid here. But holding both locks at once * would be a nasty concurrency hit (and in fact could cause a * deadlock against GetSnapshotData). So for now, assume atomicity. - * Note that readers of PROC xid field should be careful to fetch the + * Note that readers of PGPROC xid field should be careful to fetch the * value only once, rather than assume they can read it multiple times * and get the same answer each time. * - * A solution to the atomic-store problem would be to give each PROC its - * own spinlock used only for fetching/storing that PROC's xid. + * A solution to the atomic-store problem would be to give each PGPROC its + * own spinlock used only for fetching/storing that PGPROC's xid. * (SInvalLock would then mean primarily that PROCs couldn't be added/ * removed while holding the lock.) */ - if (MyProc != (PROC *) NULL) + if (MyProc != (PGPROC *) NULL) MyProc->xid = xid; LWLockRelease(XidGenLock); diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index f2a3caeabd..0159295cf5 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.125 2002/05/25 20:00:12 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.126 2002/06/11 13:40:50 wieck Exp $ * * NOTES * Transaction aborts can now occur two ways: @@ -602,7 +602,7 @@ RecordTransactionCommit(void) MyLastRecPtr.xrecoff = 0; MyXactMadeXLogEntry = false; - /* Show myself as out of the transaction in PROC array */ + /* Show myself as out of the transaction in PGPROC array */ MyProc->logRec.xrecoff = 0; if (leak) @@ -727,7 +727,7 @@ RecordTransactionAbort(void) MyLastRecPtr.xrecoff = 0; MyXactMadeXLogEntry = false; - /* Show myself as out of the transaction in PROC array */ + /* Show myself as out of the transaction in PGPROC array */ MyProc->logRec.xrecoff = 0; /* @@ -960,7 +960,7 @@ CommitTransaction(void) * as running as well or it will see two tuple versions - one deleted * by xid 1 and one inserted by xid 0. See notes in GetSnapshotData. */ - if (MyProc != (PROC *) NULL) + if (MyProc != (PGPROC *) NULL) { /* Lock SInvalLock because that's what GetSnapshotData uses. */ LWLockAcquire(SInvalLock, LW_EXCLUSIVE); @@ -1069,7 +1069,7 @@ AbortTransaction(void) * this must be done _before_ releasing locks we hold and _after_ * RecordTransactionAbort. */ - if (MyProc != (PROC *) NULL) + if (MyProc != (PGPROC *) NULL) { /* Lock SInvalLock because that's what GetSnapshotData uses. */ LWLockAcquire(SInvalLock, LW_EXCLUSIVE); diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index c80c73f9e3..7f7701eb55 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.96 2002/06/07 21:47:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.97 2002/06/11 13:40:50 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -753,7 +753,7 @@ begin:; /* Compute record's XLOG location */ INSERT_RECPTR(RecPtr, Insert, curridx); - /* If first XLOG record of transaction, save it in PROC array */ + /* If first XLOG record of transaction, save it in PGPROC array */ if (MyLastRecPtr.xrecoff == 0 && !no_tran) { /* @@ -3026,7 +3026,7 @@ CreateCheckPoint(bool shutdown) } /* - * Get UNDO record ptr - this is oldest of PROC->logRec values. We do + * Get UNDO record ptr - this is oldest of PGPROC->logRec values. We do * this while holding insert lock to ensure that we won't miss any * about-to-commit transactions (UNDO must include all xacts that have * commits after REDO point). diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index e6250d0c50..2bd68069c8 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.46 2002/04/27 21:24:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.47 2002/06/11 13:40:50 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -93,7 +93,7 @@ int num_columns_read = 0; %type boot_tuple boot_tuplelist %type optoideq -%token CONST ID +%token CONST_P ID %token OPEN XCLOSE XCREATE INSERT_TUPLE %token STRING XDEFINE %token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE @@ -329,7 +329,7 @@ boot_tuple: ; boot_const : - CONST { $$=yylval.ival; } + CONST_P { $$=yylval.ival; } ; boot_ident : diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l index b471dcc66e..e0656a82a0 100644 --- a/src/backend/bootstrap/bootscanner.l +++ b/src/backend/bootstrap/bootscanner.l @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.22 2002/04/27 21:24:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.23 2002/06/11 13:40:50 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -121,7 +121,7 @@ insert { return(INSERT_TUPLE); } (-)?{D}*"."{D}+({Exp})? | (-)?{D}+{Exp} { yylval.ival = EnterString((char*)yytext); - return(CONST); + return(CONST_P); } . { diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index 8f1870473d..a790a28bcc 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/schemacmds.c,v 1.3 2002/05/17 20:53:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/schemacmds.c,v 1.4 2002/06/11 13:40:50 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -50,7 +50,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) if (!authId) { owner_userid = saved_userid; - owner_name = GetUserName(owner_userid); + owner_name = GetUserNameFromId(owner_userid); } else if (superuser()) { @@ -68,7 +68,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) else /* not superuser */ { owner_userid = saved_userid; - owner_name = GetUserName(owner_userid); + owner_name = GetUserNameFromId(owner_userid); if (strcmp(authId, owner_name) != 0) elog(ERROR, "CREATE SCHEMA: permission denied" "\n\t\"%s\" is not a superuser, so cannot create a schema for \"%s\"", diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 98f47dd98b..eb9a3e624c 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.103 2002/05/21 22:05:54 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.104 2002/06/11 13:40:50 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -724,7 +724,7 @@ AlterUser(AlterUserStmt *stmt) createuser < 0 && !validUntil && password && - strcmp(GetUserName(GetUserId()), stmt->user) == 0)) + strcmp(GetUserNameFromId(GetUserId()), stmt->user) == 0)) elog(ERROR, "ALTER USER: permission denied"); /* changes to the flat password file cannot be rolled back */ diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index 03d7a66457..9ac829094d 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.67 2002/05/17 01:19:17 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.68 2002/06/11 13:40:50 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -583,5 +583,5 @@ assign_session_authorization(const char *value, bool doit, bool interactive) const char * show_session_authorization(void) { - return GetUserName(GetSessionUserId()); + return GetUserNameFromId(GetSessionUserId()); } diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index d1109b58a7..fbf63db85e 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.319 2002/05/22 17:20:59 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.320 2002/06/11 13:40:50 wieck Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -321,25 +321,25 @@ static void doNegateFloat(Value *v); BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH, BOOLEAN, BY, - CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR, CHARACTER, + CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR_P, CHARACTER, CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE, COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY, CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE, DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED, - DEFINER, DELETE, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP, + DEFINER, DELETE_P, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP, EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE, EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT, - FALSE_P, FETCH, FLOAT, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM, + FALSE_P, FETCH, FLOAT_P, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM, FULL, FUNCTION, - GLOBAL, GRANT, GROUP, + GLOBAL, GRANT, GROUP_P, HANDLER, HAVING, HOUR_P, - ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN, INCREMENT, INDEX, INHERITS, + ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN_P, INCREMENT, INDEX, INHERITS, INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT, INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION, @@ -356,7 +356,7 @@ static void doNegateFloat(Value *v); NUMERIC, OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER, - OUT, OUTER_P, OVERLAPS, OWNER, + OUT_P, OUTER_P, OVERLAPS, OWNER, PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL, @@ -406,7 +406,7 @@ static void doNegateFloat(Value *v); %nonassoc ESCAPE %nonassoc OVERLAPS %nonassoc BETWEEN -%nonassoc IN +%nonassoc IN_P %left POSTFIXOP /* dummy for postfix Op rules */ %left Op OPERATOR /* multi-character ops and user-defined operators */ %nonassoc NOTNULL @@ -647,7 +647,7 @@ OptUserElem: PASSWORD Sconst $$->defname = "createuser"; $$->arg = (Node *)makeInteger(FALSE); } - | IN GROUP user_list + | IN_P GROUP_P user_list { $$ = makeNode(DefElem); $$->defname = "groupElts"; @@ -680,14 +680,14 @@ user_list: user_list ',' UserId * *****************************************************************************/ -CreateGroupStmt: CREATE GROUP UserId OptGroupList +CreateGroupStmt: CREATE GROUP_P UserId OptGroupList { CreateGroupStmt *n = makeNode(CreateGroupStmt); n->name = $3; n->options = $4; $$ = (Node *)n; } - | CREATE GROUP UserId WITH OptGroupList + | CREATE GROUP_P UserId WITH OptGroupList { CreateGroupStmt *n = makeNode(CreateGroupStmt); n->name = $3; @@ -725,7 +725,7 @@ OptGroupElem: USER user_list * *****************************************************************************/ -AlterGroupStmt: ALTER GROUP UserId ADD USER user_list +AlterGroupStmt: ALTER GROUP_P UserId ADD USER user_list { AlterGroupStmt *n = makeNode(AlterGroupStmt); n->name = $3; @@ -733,7 +733,7 @@ AlterGroupStmt: ALTER GROUP UserId ADD USER user_list n->listUsers = $6; $$ = (Node *)n; } - | ALTER GROUP UserId DROP USER user_list + | ALTER GROUP_P UserId DROP USER user_list { AlterGroupStmt *n = makeNode(AlterGroupStmt); n->name = $3; @@ -751,7 +751,7 @@ AlterGroupStmt: ALTER GROUP UserId ADD USER user_list * *****************************************************************************/ -DropGroupStmt: DROP GROUP UserId +DropGroupStmt: DROP GROUP_P UserId { DropGroupStmt *n = makeNode(DropGroupStmt); n->name = $3; @@ -1671,7 +1671,7 @@ key_actions: key_delete { $$ = $1; } | /*EMPTY*/ { $$ = 0; } ; -key_delete: ON DELETE key_reference { $$ = $3 << FKCONSTR_ON_DELETE_SHIFT; } +key_delete: ON DELETE_P key_reference { $$ = $3 << FKCONSTR_ON_DELETE_SHIFT; } ; key_update: ON UPDATE key_reference { $$ = $3 << FKCONSTR_ON_UPDATE_SHIFT; } @@ -1963,7 +1963,7 @@ TriggerEvents: TriggerOneEvent ; TriggerOneEvent: INSERT { $$ = 'i'; } - | DELETE { $$ = 'd'; } + | DELETE_P { $$ = 'd'; } | UPDATE { $$ = 'u'; } ; @@ -2472,7 +2472,7 @@ fetch_how_many: Iconst { $$ = $1; } | PRIOR { $$ = -1; } ; -from_in: IN { } +from_in: IN_P { } | FROM { } ; @@ -2524,7 +2524,7 @@ privilege_list: privilege { $$ = makeListi1($1); } privilege: SELECT { $$ = ACL_SELECT; } | INSERT { $$ = ACL_INSERT; } | UPDATE { $$ = ACL_UPDATE; } - | DELETE { $$ = ACL_DELETE; } + | DELETE_P { $$ = ACL_DELETE; } | RULE { $$ = ACL_RULE; } | REFERENCES { $$ = ACL_REFERENCES; } | TRIGGER { $$ = ACL_TRIGGER; } @@ -2598,7 +2598,7 @@ grantee: ColId n->groupname = NULL; $$ = (Node *)n; } - | GROUP ColId + | GROUP_P ColId { PrivGrantee *n = makeNode(PrivGrantee); /* Treat GROUP PUBLIC as a synonym for PUBLIC */ @@ -2807,11 +2807,11 @@ func_arg: opt_arg func_type } ; -opt_arg: IN +opt_arg: IN_P { $$ = FALSE; } - | OUT + | OUT_P { elog(ERROR, "CREATE FUNCTION / OUT parameters are not supported"); $$ = TRUE; @@ -3143,7 +3143,7 @@ RuleActionStmtOrEmpty: RuleActionStmt /* change me to select, update, etc. some day */ event: SELECT { $$ = CMD_SELECT; } | UPDATE { $$ = CMD_UPDATE; } - | DELETE { $$ = CMD_DELETE; } + | DELETE_P { $$ = CMD_DELETE; } | INSERT { $$ = CMD_INSERT; } ; @@ -3728,7 +3728,7 @@ insert_column_item: ColId opt_indirection * *****************************************************************************/ -DeleteStmt: DELETE FROM relation_expr where_clause +DeleteStmt: DELETE_P FROM relation_expr where_clause { DeleteStmt *n = makeNode(DeleteStmt); n->relation = $3; @@ -3747,7 +3747,7 @@ LockStmt: LOCK_P opt_table qualified_name_list opt_lock } ; -opt_lock: IN lock_type MODE { $$ = $2; } +opt_lock: IN_P lock_type MODE { $$ = $2; } | /*EMPTY*/ { $$ = AccessExclusiveLock; } ; @@ -4134,7 +4134,7 @@ select_offset_value: Iconst * cases for these. */ -group_clause: GROUP BY expr_list { $$ = $3; } +group_clause: GROUP_P BY expr_list { $$ = $3; } | /*EMPTY*/ { $$ = NIL; } ; @@ -4535,7 +4535,7 @@ Numeric: INT { $$ = SystemTypeName("float4"); } - | FLOAT opt_float + | FLOAT_P opt_float { $$ = $2; } @@ -4726,10 +4726,10 @@ Character: character '(' Iconst ')' opt_charset ; character: CHARACTER opt_varying { $$ = $2 ? "varchar": "bpchar"; } - | CHAR opt_varying { $$ = $2 ? "varchar": "bpchar"; } + | CHAR_P opt_varying { $$ = $2 ? "varchar": "bpchar"; } | VARCHAR { $$ = "varchar"; } | NATIONAL CHARACTER opt_varying { $$ = $3 ? "varchar": "bpchar"; } - | NATIONAL CHAR opt_varying { $$ = $3 ? "varchar": "bpchar"; } + | NATIONAL CHAR_P opt_varying { $$ = $3 ? "varchar": "bpchar"; } | NCHAR opt_varying { $$ = $2 ? "varchar": "bpchar"; } ; @@ -4842,7 +4842,7 @@ opt_interval: YEAR_P { $$ = MASK(YEAR); } * Define row_descriptor to allow yacc to break the reduce/reduce conflict * with singleton expressions. */ -row_expr: '(' row_descriptor ')' IN select_with_parens +row_expr: '(' row_descriptor ')' IN_P select_with_parens { SubLink *n = makeNode(SubLink); n->lefthand = $2; @@ -4852,7 +4852,7 @@ row_expr: '(' row_descriptor ')' IN select_with_parens n->subselect = $5; $$ = (Node *)n; } - | '(' row_descriptor ')' NOT IN select_with_parens + | '(' row_descriptor ')' NOT IN_P select_with_parens { SubLink *n = makeNode(SubLink); n->lefthand = $2; @@ -5190,7 +5190,7 @@ a_expr: c_expr (Node *) makeSimpleA_Expr(OP, "<", $1, $4), (Node *) makeSimpleA_Expr(OP, ">", $1, $6)); } - | a_expr IN in_expr + | a_expr IN_P in_expr { /* in_expr returns a SubLink or a list of a_exprs */ if (IsA($3, SubLink)) @@ -5220,7 +5220,7 @@ a_expr: c_expr $$ = n; } } - | a_expr NOT IN in_expr + | a_expr NOT IN_P in_expr { /* in_expr returns a SubLink or a list of a_exprs */ if (IsA($4, SubLink)) @@ -5708,7 +5708,7 @@ extract_arg: IDENT { $$ = $1; } /* position_list uses b_expr not a_expr to avoid conflict with general IN */ -position_list: b_expr IN b_expr +position_list: b_expr IN_P b_expr { $$ = makeList2($3, $1); } | /*EMPTY*/ { $$ = NIL; } @@ -6242,7 +6242,7 @@ unreserved_keyword: | DECLARE | DEFERRED | DEFINER - | DELETE + | DELETE_P | DELIMITERS | DOMAIN_P | DOUBLE @@ -6303,7 +6303,7 @@ unreserved_keyword: | OIDS | OPERATOR | OPTION - | OUT + | OUT_P | OWNER | PARTIAL | PASSWORD @@ -6389,14 +6389,14 @@ col_name_keyword: BIGINT | BIT | BOOLEAN - | CHAR + | CHAR_P | CHARACTER | COALESCE | DEC | DECIMAL | EXISTS | EXTRACT - | FLOAT + | FLOAT_P | INT | INTEGER | INTERVAL @@ -6433,7 +6433,7 @@ func_name_keyword: | FREEZE | FULL | ILIKE - | IN + | IN_P | INNER_P | IS | ISNULL @@ -6487,7 +6487,7 @@ reserved_keyword: | FOREIGN | FROM | GRANT - | GROUP + | GROUP_P | HAVING | INITIALLY | INTERSECT diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c index 2cf91572a0..c60b2df2a6 100644 --- a/src/backend/parser/keywords.c +++ b/src/backend/parser/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.111 2002/05/22 17:20:59 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.112 2002/06/11 13:40:51 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ static const ScanKeyword ScanKeywords[] = { {"case", CASE}, {"cast", CAST}, {"chain", CHAIN}, - {"char", CHAR}, + {"char", CHAR_P}, {"character", CHARACTER}, {"characteristics", CHARACTERISTICS}, {"check", CHECK}, @@ -97,7 +97,7 @@ static const ScanKeyword ScanKeywords[] = { {"deferrable", DEFERRABLE}, {"deferred", DEFERRED}, {"definer", DEFINER}, - {"delete", DELETE}, + {"delete", DELETE_P}, {"delimiters", DELIMITERS}, {"desc", DESC}, {"distinct", DISTINCT}, @@ -120,7 +120,7 @@ static const ScanKeyword ScanKeywords[] = { {"extract", EXTRACT}, {"false", FALSE_P}, {"fetch", FETCH}, - {"float", FLOAT}, + {"float", FLOAT_P}, {"for", FOR}, {"force", FORCE}, {"foreign", FOREIGN}, @@ -131,7 +131,7 @@ static const ScanKeyword ScanKeywords[] = { {"function", FUNCTION}, {"global", GLOBAL}, {"grant", GRANT}, - {"group", GROUP}, + {"group", GROUP_P}, {"handler", HANDLER}, {"having", HAVING}, {"hour", HOUR_P}, @@ -139,7 +139,7 @@ static const ScanKeyword ScanKeywords[] = { {"immediate", IMMEDIATE}, {"immutable", IMMUTABLE}, {"implicit", IMPLICIT}, - {"in", IN}, + {"in", IN_P}, {"increment", INCREMENT}, {"index", INDEX}, {"inherits", INHERITS}, @@ -208,7 +208,7 @@ static const ScanKeyword ScanKeywords[] = { {"option", OPTION}, {"or", OR}, {"order", ORDER}, - {"out", OUT}, + {"out", OUT_P}, {"outer", OUTER_P}, {"overlaps", OVERLAPS}, {"owner", OWNER}, diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 5b53e5f77f..ca96a4482b 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -14,7 +14,7 @@ * * The postmaster process creates the shared memory and semaphore * pools during startup, but as a rule does not touch them itself. - * In particular, it is not a member of the PROC array of backends + * In particular, it is not a member of the PGPROC array of backends * and so it cannot participate in lock-manager operations. Keeping * the postmaster away from shared memory operations makes it simpler * and more reliable. The postmaster is almost always able to recover @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.275 2002/05/28 23:56:51 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.276 2002/06/11 13:40:51 wieck Exp $ * * NOTES * diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c index 6415271bea..4350548f2e 100644 --- a/src/backend/storage/ipc/sinval.c +++ b/src/backend/storage/ipc/sinval.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.47 2002/05/24 18:57:56 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.48 2002/06/11 13:40:51 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -97,7 +97,7 @@ ReceiveSharedInvalidMessages( * The routines later in this file that use shared mode are okay with * this, because they aren't looking at the ProcState fields * associated with SI message transfer; they only use the - * ProcState array as an easy way to find all the PROC structures. + * ProcState array as an easy way to find all the PGPROC structures. */ LWLockAcquire(SInvalLock, LW_SHARED); getResult = SIGetDataEntry(shmInvalBuffer, MyBackendId, &data); @@ -130,12 +130,12 @@ ReceiveSharedInvalidMessages( /****************************************************************************/ -/* Functions that need to scan the PROC structures of all running backends. */ +/* Functions that need to scan the PGPROC structures of all running backends. */ /* It's a bit strange to keep these in sinval.c, since they don't have any */ /* direct relationship to shared-cache invalidation. But the procState */ /* array in the SI segment is the only place in the system where we have */ /* an array of per-backend data, so it is the most convenient place to keep */ -/* pointers to the backends' PROC structures. We used to implement these */ +/* pointers to the backends' PGPROC structures. We used to implement these */ /* functions with a slow, ugly search through the ShmemIndex hash table --- */ /* now they are simple loops over the SI ProcState array. */ /****************************************************************************/ @@ -171,7 +171,7 @@ DatabaseHasActiveBackends(Oid databaseId, bool ignoreMyself) if (pOffset != INVALID_OFFSET) { - PROC *proc = (PROC *) MAKE_PTR(pOffset); + PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset); if (proc->databaseId == databaseId) { @@ -208,7 +208,7 @@ TransactionIdIsInProgress(TransactionId xid) if (pOffset != INVALID_OFFSET) { - PROC *proc = (PROC *) MAKE_PTR(pOffset); + PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset); /* Fetch xid just once - see GetNewTransactionId */ TransactionId pxid = proc->xid; @@ -260,7 +260,7 @@ GetOldestXmin(bool allDbs) if (pOffset != INVALID_OFFSET) { - PROC *proc = (PROC *) MAKE_PTR(pOffset); + PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset); if (allDbs || proc->databaseId == MyDatabaseId) { @@ -371,7 +371,7 @@ GetSnapshotData(bool serializable) if (pOffset != INVALID_OFFSET) { - PROC *proc = (PROC *) MAKE_PTR(pOffset); + PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset); /* Fetch xid just once - see GetNewTransactionId */ TransactionId xid = proc->xid; @@ -460,7 +460,7 @@ CountActiveBackends(void) if (pOffset != INVALID_OFFSET) { - PROC *proc = (PROC *) MAKE_PTR(pOffset); + PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset); if (proc == MyProc) continue; /* do not count myself */ @@ -476,7 +476,7 @@ CountActiveBackends(void) } /* - * GetUndoRecPtr -- returns oldest PROC->logRec. + * GetUndoRecPtr -- returns oldest PGPROC->logRec. */ XLogRecPtr GetUndoRecPtr(void) @@ -495,7 +495,7 @@ GetUndoRecPtr(void) if (pOffset != INVALID_OFFSET) { - PROC *proc = (PROC *) MAKE_PTR(pOffset); + PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset); tempr = proc->logRec; if (tempr.xrecoff == 0) @@ -512,13 +512,13 @@ GetUndoRecPtr(void) } /* - * BackendIdGetProc - given a BackendId, find its PROC structure + * BackendIdGetProc - given a BackendId, find its PGPROC structure * * This is a trivial lookup in the ProcState array. We assume that the caller * knows that the backend isn't going to go away, so we do not bother with * locking. */ -struct PROC * +struct PGPROC * BackendIdGetProc(BackendId procId) { SISeg *segP = shmInvalBuffer; @@ -530,7 +530,7 @@ BackendIdGetProc(BackendId procId) if (pOffset != INVALID_OFFSET) { - PROC *proc = (PROC *) MAKE_PTR(pOffset); + PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset); return proc; } diff --git a/src/backend/storage/lmgr/deadlock.c b/src/backend/storage/lmgr/deadlock.c index 70867b6564..9916fd595e 100644 --- a/src/backend/storage/lmgr/deadlock.c +++ b/src/backend/storage/lmgr/deadlock.c @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.8 2001/10/28 06:25:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.9 2002/06/11 13:40:51 wieck Exp $ * * Interface: * @@ -31,8 +31,8 @@ /* One edge in the waits-for graph */ typedef struct { - PROC *waiter; /* the waiting process */ - PROC *blocker; /* the process it is waiting for */ + PGPROC *waiter; /* the waiting process */ + PGPROC *blocker; /* the process it is waiting for */ int pred; /* workspace for TopoSort */ int link; /* workspace for TopoSort */ } EDGE; @@ -41,20 +41,20 @@ typedef struct typedef struct { LOCK *lock; /* the lock whose wait queue is described */ - PROC **procs; /* array of PROC *'s in new wait order */ + PGPROC **procs; /* array of PGPROC *'s in new wait order */ int nProcs; } WAIT_ORDER; -static bool DeadLockCheckRecurse(PROC *proc); -static bool TestConfiguration(PROC *startProc); -static bool FindLockCycle(PROC *checkProc, +static bool DeadLockCheckRecurse(PGPROC *proc); +static bool TestConfiguration(PGPROC *startProc); +static bool FindLockCycle(PGPROC *checkProc, EDGE *softEdges, int *nSoftEdges); -static bool FindLockCycleRecurse(PROC *checkProc, +static bool FindLockCycleRecurse(PGPROC *checkProc, EDGE *softEdges, int *nSoftEdges); static bool ExpandConstraints(EDGE *constraints, int nConstraints); static bool TopoSort(LOCK *lock, EDGE *constraints, int nConstraints, - PROC **ordering); + PGPROC **ordering); #ifdef DEBUG_DEADLOCK static void PrintLockQueue(LOCK *lock, const char *info); @@ -66,18 +66,18 @@ static void PrintLockQueue(LOCK *lock, const char *info); */ /* Workspace for FindLockCycle */ -static PROC **visitedProcs; /* Array of visited procs */ +static PGPROC **visitedProcs; /* Array of visited procs */ static int nVisitedProcs; /* Workspace for TopoSort */ -static PROC **topoProcs; /* Array of not-yet-output procs */ +static PGPROC **topoProcs; /* Array of not-yet-output procs */ static int *beforeConstraints; /* Counts of remaining before-constraints */ static int *afterConstraints; /* List head for after-constraints */ /* Output area for ExpandConstraints */ static WAIT_ORDER *waitOrders; /* Array of proposed queue rearrangements */ static int nWaitOrders; -static PROC **waitOrderProcs; /* Space for waitOrders queue contents */ +static PGPROC **waitOrderProcs; /* Space for waitOrders queue contents */ /* Current list of constraints being considered */ static EDGE *curConstraints; @@ -111,7 +111,7 @@ InitDeadLockChecking(void) /* * FindLockCycle needs at most MaxBackends entries in visitedProcs[] */ - visitedProcs = (PROC **) palloc(MaxBackends * sizeof(PROC *)); + visitedProcs = (PGPROC **) palloc(MaxBackends * sizeof(PGPROC *)); /* * TopoSort needs to consider at most MaxBackends wait-queue entries, @@ -128,7 +128,7 @@ InitDeadLockChecking(void) * than MaxBackends total waiters. */ waitOrders = (WAIT_ORDER *) palloc((MaxBackends / 2) * sizeof(WAIT_ORDER)); - waitOrderProcs = (PROC **) palloc(MaxBackends * sizeof(PROC *)); + waitOrderProcs = (PGPROC **) palloc(MaxBackends * sizeof(PGPROC *)); /* * Allow at most MaxBackends distinct constraints in a configuration. @@ -176,7 +176,7 @@ InitDeadLockChecking(void) * interlocked! */ bool -DeadLockCheck(PROC *proc) +DeadLockCheck(PGPROC *proc) { int i, j; @@ -194,7 +194,7 @@ DeadLockCheck(PROC *proc) for (i = 0; i < nWaitOrders; i++) { LOCK *lock = waitOrders[i].lock; - PROC **procs = waitOrders[i].procs; + PGPROC **procs = waitOrders[i].procs; int nProcs = waitOrders[i].nProcs; PROC_QUEUE *waitQueue = &(lock->waitProcs); @@ -234,7 +234,7 @@ DeadLockCheck(PROC *proc) * rearrangements of lock wait queues (if any). */ static bool -DeadLockCheckRecurse(PROC *proc) +DeadLockCheckRecurse(PGPROC *proc) { int nEdges; int oldPossibleConstraints; @@ -300,7 +300,7 @@ DeadLockCheckRecurse(PROC *proc) *-------------------- */ static bool -TestConfiguration(PROC *startProc) +TestConfiguration(PGPROC *startProc) { int softFound = 0; EDGE *softEdges = possibleConstraints + nPossibleConstraints; @@ -365,7 +365,7 @@ TestConfiguration(PROC *startProc) * be believed in preference to the actual ordering seen in the locktable. */ static bool -FindLockCycle(PROC *checkProc, +FindLockCycle(PGPROC *checkProc, EDGE *softEdges, /* output argument */ int *nSoftEdges) /* output argument */ { @@ -375,11 +375,11 @@ FindLockCycle(PROC *checkProc, } static bool -FindLockCycleRecurse(PROC *checkProc, +FindLockCycleRecurse(PGPROC *checkProc, EDGE *softEdges, /* output argument */ int *nSoftEdges) /* output argument */ { - PROC *proc; + PGPROC *proc; LOCK *lock; HOLDER *holder; SHM_QUEUE *lockHolders; @@ -438,7 +438,7 @@ FindLockCycleRecurse(PROC *checkProc, while (holder) { - proc = (PROC *) MAKE_PTR(holder->tag.proc); + proc = (PGPROC *) MAKE_PTR(holder->tag.proc); /* A proc never blocks itself */ if (proc != checkProc) @@ -480,7 +480,7 @@ FindLockCycleRecurse(PROC *checkProc, if (i < nWaitOrders) { /* Use the given hypothetical wait queue order */ - PROC **procs = waitOrders[i].procs; + PGPROC **procs = waitOrders[i].procs; queue_size = waitOrders[i].nProcs; @@ -517,7 +517,7 @@ FindLockCycleRecurse(PROC *checkProc, waitQueue = &(lock->waitProcs); queue_size = waitQueue->size; - proc = (PROC *) MAKE_PTR(waitQueue->links.next); + proc = (PGPROC *) MAKE_PTR(waitQueue->links.next); while (queue_size-- > 0) { @@ -543,7 +543,7 @@ FindLockCycleRecurse(PROC *checkProc, } } - proc = (PROC *) MAKE_PTR(proc->links.next); + proc = (PGPROC *) MAKE_PTR(proc->links.next); } } @@ -559,7 +559,7 @@ FindLockCycleRecurse(PROC *checkProc, * specific new orderings for affected wait queues * * Input is a list of soft edges to be reversed. The output is a list - * of nWaitOrders WAIT_ORDER structs in waitOrders[], with PROC array + * of nWaitOrders WAIT_ORDER structs in waitOrders[], with PGPROC array * workspace in waitOrderProcs[]. * * Returns TRUE if able to build an ordering that satisfies all the @@ -582,7 +582,7 @@ ExpandConstraints(EDGE *constraints, */ for (i = nConstraints; --i >= 0;) { - PROC *proc = constraints[i].waiter; + PGPROC *proc = constraints[i].waiter; LOCK *lock = proc->waitLock; /* Did we already make a list for this lock? */ @@ -628,7 +628,7 @@ ExpandConstraints(EDGE *constraints, * slowness of the algorithm won't really matter. * * The initial queue ordering is taken directly from the lock's wait queue. - * The output is an array of PROC pointers, of length equal to the lock's + * The output is an array of PGPROC pointers, of length equal to the lock's * wait queue length (the caller is responsible for providing this space). * The partial order is specified by an array of EDGE structs. Each EDGE * is one that we need to reverse, therefore the "waiter" must appear before @@ -642,22 +642,22 @@ static bool TopoSort(LOCK *lock, EDGE *constraints, int nConstraints, - PROC **ordering) /* output argument */ + PGPROC **ordering) /* output argument */ { PROC_QUEUE *waitQueue = &(lock->waitProcs); int queue_size = waitQueue->size; - PROC *proc; + PGPROC *proc; int i, j, k, last; /* First, fill topoProcs[] array with the procs in their current order */ - proc = (PROC *) MAKE_PTR(waitQueue->links.next); + proc = (PGPROC *) MAKE_PTR(waitQueue->links.next); for (i = 0; i < queue_size; i++) { topoProcs[i] = proc; - proc = (PROC *) MAKE_PTR(proc->links.next); + proc = (PGPROC *) MAKE_PTR(proc->links.next); } /* @@ -743,15 +743,15 @@ PrintLockQueue(LOCK *lock, const char *info) { PROC_QUEUE *waitQueue = &(lock->waitProcs); int queue_size = waitQueue->size; - PROC *proc; + PGPROC *proc; int i; printf("%s lock %lx queue ", info, MAKE_OFFSET(lock)); - proc = (PROC *) MAKE_PTR(waitQueue->links.next); + proc = (PGPROC *) MAKE_PTR(waitQueue->links.next); for (i = 0; i < queue_size; i++) { printf(" %d", proc->pid); - proc = (PROC *) MAKE_PTR(proc->links.next); + proc = (PGPROC *) MAKE_PTR(proc->links.next); } printf("\n"); fflush(stdout); diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index 88f3049654..d3965fab95 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.106 2002/03/06 06:10:06 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.107 2002/06/11 13:40:51 wieck Exp $ * * NOTES * Outside modules can create a lock table and acquire/release @@ -49,7 +49,7 @@ int max_locks_per_xact; /* set by guc.c */ static int WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode, LOCK *lock, HOLDER *holder); -static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, +static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PGPROC *proc, int *myHolding); static char *lock_mode_names[] = @@ -746,7 +746,7 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode, LOCK *lock, HOLDER *holder, - PROC *proc, + PGPROC *proc, int *myHolding) /* myHolding[] array or NULL */ { LOCKMETHODCTL *lockctl = lockMethodTable->ctl; @@ -820,7 +820,7 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, * be a net slowdown. */ static void -LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding) +LockCountMyLocks(SHMEM_OFFSET lockOffset, PGPROC *proc, int *myHolding) { SHM_QUEUE *procHolders = &(proc->procHolders); HOLDER *holder; @@ -944,7 +944,7 @@ WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode, * this routine can only happen if we are aborting the transaction.) */ void -RemoveFromWaitQueue(PROC *proc) +RemoveFromWaitQueue(PGPROC *proc) { LOCK *waitLock = proc->waitLock; LOCKMODE lockmode = proc->waitLockMode; @@ -1182,7 +1182,7 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, * specified XID are released. */ bool -LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, +LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc, bool allxids, TransactionId xid) { SHM_QUEUE *procHolders = &(proc->procHolders); @@ -1354,7 +1354,7 @@ LockShmemSize(int maxBackends) long max_table_size = NLOCKENTS(maxBackends); size += MAXALIGN(sizeof(PROC_HDR)); /* ProcGlobal */ - size += maxBackends * MAXALIGN(sizeof(PROC)); /* each MyProc */ + size += maxBackends * MAXALIGN(sizeof(PGPROC)); /* each MyProc */ size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL)); /* each * lockMethodTable->ctl */ @@ -1383,7 +1383,7 @@ LockShmemSize(int maxBackends) void DumpLocks(void) { - PROC *proc; + PGPROC *proc; SHM_QUEUE *procHolders; HOLDER *holder; LOCK *lock; @@ -1427,7 +1427,7 @@ DumpLocks(void) void DumpAllLocks(void) { - PROC *proc; + PGPROC *proc; HOLDER *holder; LOCK *lock; int lockmethod = DEFAULT_LOCKMETHOD; diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index 8dbf55c078..e781f856d1 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v 1.10 2002/05/05 00:03:28 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v 1.11 2002/06/11 13:40:51 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -29,12 +29,12 @@ typedef struct LWLock { - slock_t mutex; /* Protects LWLock and queue of PROCs */ + slock_t mutex; /* Protects LWLock and queue of PGPROCs */ bool releaseOK; /* T if ok to release waiters */ char exclusive; /* # of exclusive holders (0 or 1) */ int shared; /* # of shared holders (0..MaxBackends) */ - PROC *head; /* head of list of waiting PROCs */ - PROC *tail; /* tail of list of waiting PROCs */ + PGPROC *head; /* head of list of waiting PGPROCs */ + PGPROC *tail; /* tail of list of waiting PGPROCs */ /* tail is undefined when head is NULL */ } LWLock; @@ -197,7 +197,7 @@ void LWLockAcquire(LWLockId lockid, LWLockMode mode) { volatile LWLock *lock = LWLockArray + lockid; - PROC *proc = MyProc; + PGPROC *proc = MyProc; bool retry = false; int extraWaits = 0; @@ -266,12 +266,12 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode) /* * Add myself to wait queue. * - * If we don't have a PROC structure, there's no way to wait. This + * If we don't have a PGPROC structure, there's no way to wait. This * should never occur, since MyProc should only be null during * shared memory initialization. */ if (proc == NULL) - elog(FATAL, "LWLockAcquire: can't wait without a PROC structure"); + elog(FATAL, "LWLockAcquire: can't wait without a PGPROC structure"); proc->lwWaiting = true; proc->lwExclusive = (mode == LW_EXCLUSIVE); @@ -401,8 +401,8 @@ void LWLockRelease(LWLockId lockid) { volatile LWLock *lock = LWLockArray + lockid; - PROC *head; - PROC *proc; + PGPROC *head; + PGPROC *proc; int i; PRINT_LWDEBUG("LWLockRelease", lockid, lock); @@ -446,7 +446,7 @@ LWLockRelease(LWLockId lockid) if (lock->exclusive == 0 && lock->shared == 0 && lock->releaseOK) { /* - * Remove the to-be-awakened PROCs from the queue. If the + * Remove the to-be-awakened PGPROCs from the queue. If the * front waiter wants exclusive lock, awaken him only. * Otherwise awaken as many waiters as want shared access. */ @@ -459,7 +459,7 @@ LWLockRelease(LWLockId lockid) proc = proc->lwWaitLink; } } - /* proc is now the last PROC to be released */ + /* proc is now the last PGPROC to be released */ lock->head = proc->lwWaitLink; proc->lwWaitLink = NULL; /* prevent additional wakeups until retryer gets to run */ diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 8ccaff9477..b7ac29b1df 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.119 2002/05/05 00:03:28 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.120 2002/06/11 13:40:51 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -55,12 +55,12 @@ int DeadlockTimeout = 1000; -PROC *MyProc = NULL; +PGPROC *MyProc = NULL; /* - * This spinlock protects the freelist of recycled PROC structures. + * This spinlock protects the freelist of recycled PGPROC structures. * We cannot use an LWLock because the LWLock manager depends on already - * having a PROC and a wait semaphore! But these structures are touched + * having a PGPROC and a wait semaphore! But these structures are touched * relatively infrequently (only at backend startup or shutdown) and not for * very long, so a spinlock is okay. */ @@ -68,7 +68,7 @@ static slock_t *ProcStructLock = NULL; static PROC_HDR *ProcGlobal = NULL; -static PROC *DummyProc = NULL; +static PGPROC *DummyProc = NULL; static bool waitingForLock = false; static bool waitingForSignal = false; @@ -129,29 +129,29 @@ InitProcGlobal(int maxBackends) ProcGlobal->freeProcs = INVALID_OFFSET; /* - * Pre-create the PROC structures and create a semaphore for each. + * Pre-create the PGPROC structures and create a semaphore for each. */ for (i = 0; i < maxBackends; i++) { - PROC *proc; + PGPROC *proc; - proc = (PROC *) ShmemAlloc(sizeof(PROC)); + proc = (PGPROC *) ShmemAlloc(sizeof(PGPROC)); if (!proc) elog(FATAL, "cannot create new proc: out of memory"); - MemSet(proc, 0, sizeof(PROC)); + MemSet(proc, 0, sizeof(PGPROC)); PGSemaphoreCreate(&proc->sem); proc->links.next = ProcGlobal->freeProcs; ProcGlobal->freeProcs = MAKE_OFFSET(proc); } /* - * Pre-allocate a PROC structure for dummy (checkpoint) processes, + * Pre-allocate a PGPROC structure for dummy (checkpoint) processes, * too. This does not get linked into the freeProcs list. */ - DummyProc = (PROC *) ShmemAlloc(sizeof(PROC)); + DummyProc = (PGPROC *) ShmemAlloc(sizeof(PGPROC)); if (!DummyProc) elog(FATAL, "cannot create new proc: out of memory"); - MemSet(DummyProc, 0, sizeof(PROC)); + MemSet(DummyProc, 0, sizeof(PGPROC)); DummyProc->pid = 0; /* marks DummyProc as not in use */ PGSemaphoreCreate(&DummyProc->sem); @@ -183,7 +183,7 @@ InitProcess(void) /* * Try to get a proc struct from the free list. If this fails, - * we must be out of PROC structures (not to mention semaphores). + * we must be out of PGPROC structures (not to mention semaphores). */ SpinLockAcquire(ProcStructLock); @@ -191,14 +191,14 @@ InitProcess(void) if (myOffset != INVALID_OFFSET) { - MyProc = (PROC *) MAKE_PTR(myOffset); + MyProc = (PGPROC *) MAKE_PTR(myOffset); procglobal->freeProcs = MyProc->links.next; SpinLockRelease(ProcStructLock); } else { /* - * If we reach here, all the PROCs are in use. This is one of + * If we reach here, all the PGPROCs are in use. This is one of * the possible places to detect "too many backends", so give the * standard error message. */ @@ -236,7 +236,7 @@ InitProcess(void) PGSemaphoreReset(&MyProc->sem); /* - * Now that we have a PROC, we could try to acquire locks, so + * Now that we have a PGPROC, we could try to acquire locks, so * initialize the deadlock checker. */ InitDeadLockChecking(); @@ -246,7 +246,7 @@ InitProcess(void) * InitDummyProcess -- create a dummy per-process data structure * * This is called by checkpoint processes so that they will have a MyProc - * value that's real enough to let them wait for LWLocks. The PROC and + * value that's real enough to let them wait for LWLocks. The PGPROC and * sema that are assigned are the extra ones created during InitProcGlobal. */ void @@ -402,11 +402,11 @@ ProcKill(void) SpinLockAcquire(ProcStructLock); - /* Return PROC structure (and semaphore) to freelist */ + /* Return PGPROC structure (and semaphore) to freelist */ MyProc->links.next = procglobal->freeProcs; procglobal->freeProcs = MAKE_OFFSET(MyProc); - /* PROC struct isn't mine anymore */ + /* PGPROC struct isn't mine anymore */ MyProc = NULL; SpinLockRelease(ProcStructLock); @@ -414,7 +414,7 @@ ProcKill(void) /* * DummyProcKill() -- Cut-down version of ProcKill for dummy (checkpoint) - * processes. The PROC and sema are not released, only marked + * processes. The PGPROC and sema are not released, only marked * as not-in-use. */ static void @@ -433,7 +433,7 @@ DummyProcKill(void) /* Mark DummyProc no longer in use */ MyProc->pid = 0; - /* PROC struct isn't mine anymore */ + /* PGPROC struct isn't mine anymore */ MyProc = NULL; } @@ -506,7 +506,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable, PROC_QUEUE *waitQueue = &(lock->waitProcs); int myHeldLocks = MyProc->heldLocks; bool early_deadlock = false; - PROC *proc; + PGPROC *proc; int i; /* @@ -531,7 +531,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable, { int aheadRequests = 0; - proc = (PROC *) MAKE_PTR(waitQueue->links.next); + proc = (PGPROC *) MAKE_PTR(waitQueue->links.next); for (i = 0; i < waitQueue->size; i++) { /* Must he wait for me? */ @@ -568,7 +568,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable, } /* Nope, so advance to next waiter */ aheadRequests |= (1 << proc->waitLockMode); - proc = (PROC *) MAKE_PTR(proc->links.next); + proc = (PGPROC *) MAKE_PTR(proc->links.next); } /* @@ -579,7 +579,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable, else { /* I hold no locks, so I can't push in front of anyone. */ - proc = (PROC *) &(waitQueue->links); + proc = (PGPROC *) &(waitQueue->links); } /* @@ -591,7 +591,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable, lock->waitMask |= (1 << lockmode); - /* Set up wait information in PROC object, too */ + /* Set up wait information in PGPROC object, too */ MyProc->waitLock = lock; MyProc->waitHolder = holder; MyProc->waitLockMode = lockmode; @@ -685,20 +685,20 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable, * works correctly for that case. To clean up in failure case, would need * to twiddle the lock's request counts too --- see RemoveFromWaitQueue. */ -PROC * -ProcWakeup(PROC *proc, int errType) +PGPROC * +ProcWakeup(PGPROC *proc, int errType) { - PROC *retProc; + PGPROC *retProc; /* assume that masterLock has been acquired */ /* Proc should be sleeping ... */ if (proc->links.prev == INVALID_OFFSET || proc->links.next == INVALID_OFFSET) - return (PROC *) NULL; + return (PGPROC *) NULL; /* Save next process before we zap the list link */ - retProc = (PROC *) MAKE_PTR(proc->links.next); + retProc = (PGPROC *) MAKE_PTR(proc->links.next); /* Remove process from wait queue */ SHMQueueDelete(&(proc->links)); @@ -726,7 +726,7 @@ ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock) LOCKMETHODCTL *lockctl = lockMethodTable->ctl; PROC_QUEUE *waitQueue = &(lock->waitProcs); int queue_size = waitQueue->size; - PROC *proc; + PGPROC *proc; int aheadRequests = 0; Assert(queue_size >= 0); @@ -734,7 +734,7 @@ ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock) if (queue_size == 0) return; - proc = (PROC *) MAKE_PTR(waitQueue->links.next); + proc = (PGPROC *) MAKE_PTR(waitQueue->links.next); while (queue_size-- > 0) { @@ -769,7 +769,7 @@ ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock) * checks. */ aheadRequests |= (1 << lockmode); - proc = (PROC *) MAKE_PTR(proc->links.next); + proc = (PGPROC *) MAKE_PTR(proc->links.next); } } @@ -902,7 +902,7 @@ ProcCancelWaitForSignal(void) void ProcSendSignal(BackendId procId) { - PROC *proc = BackendIdGetProc(procId); + PGPROC *proc = BackendIdGetProc(procId); if (proc != NULL) PGSemaphoreUnlock(&proc->sem); diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index eac2371040..6e0c0b7130 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.67 2002/06/01 15:52:15 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.68 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -69,7 +69,7 @@ date_in(PG_FUNCTION_ARGS) case DTK_CURRENT: elog(ERROR, "Date CURRENT no longer supported" "\n\tdate_in() internal coding error"); - GetCurrentTime(tm); + GetCurrentDateTime(tm); break; case DTK_EPOCH: @@ -1697,7 +1697,7 @@ time_timetz(PG_FUNCTION_ARGS) fsec_t fsec; int tz; - GetCurrentTime(tm); + GetCurrentDateTime(tm); time2tm(time, tm, &fsec); tz = DetermineLocalTimeZone(tm); diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index d6e0358e81..c5dd8036f5 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.90 2002/05/17 01:19:18 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.91 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ static datetkn datetktbl[] = { {"acst", DTZ, NEG(24)}, /* Atlantic/Porto Acre */ {"act", TZ, NEG(30)}, /* Atlantic/Porto Acre */ {DA_D, ADBC, AD}, /* "ad" for years >= 0 */ - {"abstime", IGNORE, 0}, /* for pre-v6.1 "Invalid Abstime" */ + {"abstime", IGNORE_DTF, 0}, /* for pre-v6.1 "Invalid Abstime" */ {"adt", DTZ, NEG(18)}, /* Atlantic Daylight Time */ {"aesst", DTZ, 66}, /* E. Australia */ {"aest", TZ, 60}, /* Australia Eastern Std Time */ @@ -115,7 +115,7 @@ ast /* Atlantic Standard Time, Arabia Standard Time, Acre Standard Time */ {"apr", MONTH, 4}, {"april", MONTH, 4}, {"ast", TZ, NEG(24)}, /* Atlantic Std Time (Canada) */ - {"at", IGNORE, 0}, /* "at" (throwaway) */ + {"at", IGNORE_DTF, 0}, /* "at" (throwaway) */ {"aug", MONTH, 8}, {"august", MONTH, 8}, {"awsst", DTZ, 54}, /* W. Australia */ @@ -348,7 +348,7 @@ ncst {"october", MONTH, 10}, {"omsst", DTZ, 42}, /* Omsk Summer Time */ {"omst", TZ, 36}, /* Omsk Time */ - {"on", IGNORE, 0}, /* "on" (throwaway) */ + {"on", IGNORE_DTF, 0}, /* "on" (throwaway) */ {"pdt", DTZ, NEG(42)}, /* Pacific Daylight Time */ #if 0 pest @@ -494,7 +494,7 @@ sizeof australian_datetktbl[0]; static datetkn deltatktbl[] = { /* text, token, lexval */ - {"@", IGNORE, 0}, /* postgres relative prefix */ + {"@", IGNORE_DTF, 0}, /* postgres relative prefix */ {DAGO, AGO, 0}, /* "ago" indicates negative time offset */ {"c", UNITS, DTK_CENTURY}, /* "century" relative */ {"cent", UNITS, DTK_CENTURY}, /* "century" relative */ @@ -536,7 +536,7 @@ static datetkn deltatktbl[] = { {"msecs", UNITS, DTK_MILLISEC}, {"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative */ {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */ - {"reltime", IGNORE, 0}, /* pre-v6.1 "Undefined Reltime" */ + {"reltime", IGNORE_DTF, 0}, /* pre-v6.1 "Undefined Reltime" */ {"s", UNITS, DTK_SECOND}, {"sec", UNITS, DTK_SECOND}, {DSECOND, UNITS, DTK_SECOND}, @@ -1198,7 +1198,7 @@ DecodeDateTime(char **field, int *ftype, int nf, case DTK_STRING: case DTK_SPECIAL: type = DecodeSpecial(i, field[i], &val); - if (type == IGNORE) + if (type == IGNORE_DTF) continue; tmask = DTK_M(type); @@ -1223,7 +1223,7 @@ DecodeDateTime(char **field, int *ftype, int nf, case DTK_YESTERDAY: tmask = DTK_DATE_M; *dtype = DTK_DATE; - GetCurrentTime(tm); + GetCurrentDateTime(tm); j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1), &tm->tm_year, &tm->tm_mon, &tm->tm_mday); tm->tm_hour = 0; @@ -1234,7 +1234,7 @@ DecodeDateTime(char **field, int *ftype, int nf, case DTK_TODAY: tmask = DTK_DATE_M; *dtype = DTK_DATE; - GetCurrentTime(tm); + GetCurrentDateTime(tm); tm->tm_hour = 0; tm->tm_min = 0; tm->tm_sec = 0; @@ -1243,7 +1243,7 @@ DecodeDateTime(char **field, int *ftype, int nf, case DTK_TOMORROW: tmask = DTK_DATE_M; *dtype = DTK_DATE; - GetCurrentTime(tm); + GetCurrentDateTime(tm); j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1), &tm->tm_year, &tm->tm_mon, &tm->tm_mday); tm->tm_hour = 0; @@ -1319,7 +1319,7 @@ DecodeDateTime(char **field, int *ftype, int nf, ftype[i] = DTK_TZ; break; - case IGNORE: + case IGNORE_DTF: break; case AMPM: @@ -1815,7 +1815,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, case DTK_STRING: case DTK_SPECIAL: type = DecodeSpecial(i, field[i], &val); - if (type == IGNORE) + if (type == IGNORE_DTF) continue; tmask = DTK_M(type); @@ -1885,7 +1885,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, ftype[i] = DTK_TZ; break; - case IGNORE: + case IGNORE_DTF: break; case AMPM: @@ -1967,7 +1967,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, if ((fmask & DTK_DATE_M) == 0) { - GetCurrentTime(tmp); + GetCurrentDateTime(tmp); } else { @@ -2043,7 +2043,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm) if (isalpha((unsigned char) *field[i])) { type = DecodeSpecial(i, field[i], &val); - if (type == IGNORE) + if (type == IGNORE_DTF) continue; dmask = DTK_M(type); @@ -2576,7 +2576,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse *dtype = DTK_DELTA; - type = IGNORE; + type = IGNORE_DTF; tm->tm_year = 0; tm->tm_mon = 0; tm->tm_mday = 0; @@ -2633,7 +2633,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse tmask = DTK_M(TZ); break; } - else if (type == IGNORE) + else if (type == IGNORE_DTF) { if (*cp == '.') { @@ -2658,7 +2658,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse case DTK_NUMBER: val = strtol(field[i], &cp, 10); - if (type == IGNORE) + if (type == IGNORE_DTF) type = DTK_SECOND; if (*cp == '.') @@ -2826,7 +2826,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse case DTK_STRING: case DTK_SPECIAL: type = DecodeUnits(i, field[i], &val); - if (type == IGNORE) + if (type == IGNORE_DTF) continue; tmask = 0; /* DTK_M(type); */ diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 651ca00d78..98adb9a194 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.93 2002/04/21 19:48:12 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.94 2002/06/11 13:40:52 wieck Exp $ * * NOTES * @@ -239,14 +239,14 @@ GetCurrentAbsoluteTimeUsec(int *usec) void -GetCurrentTime(struct tm * tm) +GetCurrentDateTime(struct tm * tm) { int tz; abstime2tm(GetCurrentTransactionStartTime(), &tz, tm, NULL); return; -} /* GetCurrentTime() */ +} /* GetCurrentDateTime() */ void diff --git a/src/backend/utils/adt/name.c b/src/backend/utils/adt/name.c index 8ffaa6e4f4..3777bab939 100644 --- a/src/backend/utils/adt/name.c +++ b/src/backend/utils/adt/name.c @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.35 2002/05/17 20:53:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.36 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -219,13 +219,13 @@ namestrcmp(Name name, const char *str) Datum current_user(PG_FUNCTION_ARGS) { - PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserName(GetUserId())))); + PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserNameFromId(GetUserId())))); } Datum session_user(PG_FUNCTION_ARGS) { - PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserName(GetSessionUserId())))); + PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserNameFromId(GetSessionUserId())))); } diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index fd3f191d5c..b602ba8796 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.91 2002/05/17 01:19:18 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.92 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -676,7 +676,7 @@ SetSessionAuthorization(Oid userid) * Get user name from user id */ char * -GetUserName(Oid userid) +GetUserNameFromId(Oid userid) { HeapTuple tuple; char *result; diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 5c0fd2d3ea..04cd1dd631 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.106 2002/05/20 23:51:43 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.107 2002/06/11 13:40:52 wieck Exp $ * * *------------------------------------------------------------------------- @@ -286,9 +286,9 @@ InitPostgres(const char *dbname, const char *username) */ /* - * Set up my per-backend PROC struct in shared memory. (We need to + * Set up my per-backend PGPROC struct in shared memory. (We need to * know MyDatabaseId before we can do this, since it's entered into - * the PROC struct.) + * the PGPROC struct.) */ InitProcess(); diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 2e5fc76bb7..1310b9f278 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: miscadmin.h,v 1.104 2002/05/17 01:19:19 tgl Exp $ + * $Id: miscadmin.h,v 1.105 2002/06/11 13:40:52 wieck Exp $ * * NOTES * some of the information in this file should be moved to @@ -203,7 +203,7 @@ extern char *ExpandDatabasePath(const char *path); extern void SetDatabaseName(const char *name); extern void SetDatabasePath(const char *path); -extern char *GetUserName(Oid userid); +extern char *GetUserNameFromId(Oid userid); extern Oid GetUserId(void); extern void SetUserId(Oid userid); diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 6b319b74e3..dc7e7b7577 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: lock.h,v 1.59 2001/11/05 17:46:35 momjian Exp $ + * $Id: lock.h,v 1.60 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -22,12 +22,12 @@ /* originally in procq.h */ typedef struct PROC_QUEUE { - SHM_QUEUE links; /* head of list of PROC objects */ + SHM_QUEUE links; /* head of list of PGPROC objects */ int size; /* number of entries in list */ } PROC_QUEUE; -/* struct PROC is declared in storage/proc.h, but must forward-reference it */ -typedef struct PROC PROC; +/* struct PGPROC is declared in storage/proc.h, but must forward-reference it */ +typedef struct PGPROC PGPROC; extern int max_locks_per_xact; @@ -161,7 +161,7 @@ typedef struct LOCK int grantMask; /* bitmask for lock types already granted */ int waitMask; /* bitmask for lock types awaited */ SHM_QUEUE lockHolders; /* list of HOLDER objects assoc. with lock */ - PROC_QUEUE waitProcs; /* list of PROC objects waiting on lock */ + PROC_QUEUE waitProcs; /* list of PGPROC objects waiting on lock */ int requested[MAX_LOCKMODES]; /* counts of requested * locks */ int nRequested; /* total of requested[] array */ @@ -181,8 +181,8 @@ typedef struct LOCK * holder hashtable. A HOLDERTAG value uniquely identifies a lock holder. * * There are two possible kinds of holder tags: a transaction (identified - * both by the PROC of the backend running it, and the xact's own ID) and - * a session (identified by backend PROC, with xid = InvalidTransactionId). + * both by the PGPROC of the backend running it, and the xact's own ID) and + * a session (identified by backend PGPROC, with xid = InvalidTransactionId). * * Currently, session holders are used for user locks and for cross-xact * locks obtained for VACUUM. We assume that a session lock never conflicts @@ -195,15 +195,15 @@ typedef struct LOCK * as soon as convenient. * * Each HOLDER object is linked into lists for both the associated LOCK object - * and the owning PROC object. Note that the HOLDER is entered into these + * and the owning PGPROC object. Note that the HOLDER is entered into these * lists as soon as it is created, even if no lock has yet been granted. - * A PROC that is waiting for a lock to be granted will also be linked into + * A PGPROC that is waiting for a lock to be granted will also be linked into * the lock's waitProcs queue. */ typedef struct HOLDERTAG { SHMEM_OFFSET lock; /* link to per-lockable-object information */ - SHMEM_OFFSET proc; /* link to PROC of owning backend */ + SHMEM_OFFSET proc; /* link to PGPROC of owning backend */ TransactionId xid; /* xact ID, or InvalidTransactionId */ } HOLDERTAG; @@ -235,16 +235,16 @@ extern bool LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, TransactionId xid, LOCKMODE lockmode, bool dontWait); extern bool LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, TransactionId xid, LOCKMODE lockmode); -extern bool LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, +extern bool LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc, bool allxids, TransactionId xid); extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode, - LOCK *lock, HOLDER *holder, PROC *proc, + LOCK *lock, HOLDER *holder, PGPROC *proc, int *myHolding); extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode); -extern void RemoveFromWaitQueue(PROC *proc); +extern void RemoveFromWaitQueue(PGPROC *proc); extern int LockShmemSize(int maxBackends); -extern bool DeadLockCheck(PROC *proc); +extern bool DeadLockCheck(PGPROC *proc); extern void InitDeadLockChecking(void); #ifdef LOCK_DEBUG diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index e276fddf9c..d1e915c1ca 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: proc.h,v 1.55 2002/05/05 00:03:29 tgl Exp $ + * $Id: proc.h,v 1.56 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -21,14 +21,14 @@ /* - * Each backend has a PROC struct in shared memory. There is also a list of - * currently-unused PROC structs that will be reallocated to new backends. + * Each backend has a PGPROC struct in shared memory. There is also a list of + * currently-unused PGPROC structs that will be reallocated to new backends. * - * links: list link for any list the PROC is in. When waiting for a lock, - * the PROC is linked into that lock's waitProcs queue. A recycled PROC + * links: list link for any list the PGPROC is in. When waiting for a lock, + * the PGPROC is linked into that lock's waitProcs queue. A recycled PGPROC * is linked into ProcGlobal's freeProcs list. */ -struct PROC +struct PGPROC { /* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */ SHM_QUEUE links; /* list link if process is in a list */ @@ -56,7 +56,7 @@ struct PROC /* Info about LWLock the process is currently waiting for, if any. */ bool lwWaiting; /* true if waiting for an LW lock */ bool lwExclusive; /* true if waiting for exclusive access */ - struct PROC *lwWaitLink; /* next waiter for same LW lock */ + struct PGPROC *lwWaitLink; /* next waiter for same LW lock */ /* Info about lock the process is currently waiting for, if any. */ /* waitLock and waitHolder are NULL if not currently waiting. */ @@ -70,10 +70,10 @@ struct PROC * or awaited by this backend */ }; -/* NOTE: "typedef struct PROC PROC" appears in storage/lock.h. */ +/* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */ -extern PROC *MyProc; +extern PGPROC *MyProc; /* @@ -81,7 +81,7 @@ extern PROC *MyProc; */ typedef struct PROC_HDR { - /* Head of list of free PROC structures */ + /* Head of list of free PGPROC structures */ SHMEM_OFFSET freeProcs; } PROC_HDR; @@ -102,7 +102,7 @@ extern void ProcReleaseLocks(bool isCommit); extern void ProcQueueInit(PROC_QUEUE *queue); extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode, LOCK *lock, HOLDER *holder); -extern PROC *ProcWakeup(PROC *proc, int errType); +extern PGPROC *ProcWakeup(PGPROC *proc, int errType); extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock); extern bool LockWaitCancel(void); extern void HandleDeadLock(SIGNAL_ARGS); diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h index e679910e25..e33be3a31c 100644 --- a/src/include/storage/sinval.h +++ b/src/include/storage/sinval.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: sinval.h,v 1.26 2002/03/03 17:47:56 tgl Exp $ + * $Id: sinval.h,v 1.27 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -86,7 +86,7 @@ extern bool TransactionIdIsInProgress(TransactionId xid); extern TransactionId GetOldestXmin(bool allDbs); extern int CountActiveBackends(void); -/* Use "struct PROC", not PROC, to avoid including proc.h here */ -extern struct PROC *BackendIdGetProc(BackendId procId); +/* Use "struct PGPROC", not PGPROC, to avoid including proc.h here */ +extern struct PGPROC *BackendIdGetProc(BackendId procId); #endif /* SINVAL_H */ diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h index 824e978e95..6b8ea7e55d 100644 --- a/src/include/storage/sinvaladt.h +++ b/src/include/storage/sinvaladt.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: sinvaladt.h,v 1.30 2001/11/05 17:46:35 momjian Exp $ + * $Id: sinvaladt.h,v 1.31 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -71,7 +71,7 @@ typedef struct ProcState /* nextMsgNum is -1 in an inactive ProcState array entry. */ int nextMsgNum; /* next message number to read, or -1 */ bool resetState; /* true, if backend has to reset its state */ - SHMEM_OFFSET procStruct; /* location of backend's PROC struct */ + SHMEM_OFFSET procStruct; /* location of backend's PGPROC struct */ } ProcState; /* Shared cache invalidation memory segment */ diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index 46d8753ff4..f998f4517d 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: datetime.h,v 1.30 2002/05/17 01:19:19 tgl Exp $ + * $Id: datetime.h,v 1.31 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -95,7 +95,7 @@ #define TZ 5 #define DTZ 6 #define DTZMOD 7 -#define IGNORE 8 +#define IGNORE_DTF 8 #define AMPM 9 #define HOUR 10 #define MINUTE 11 @@ -260,7 +260,7 @@ extern int day_tab[2][13]; || (((m) == UTIME_MAXMONTH) && ((d) <= UTIME_MAXDAY)))))) -extern void GetCurrentTime(struct tm * tm); +extern void GetCurrentDateTime(struct tm * tm); extern void GetCurrentTimeUsec(struct tm * tm, fsec_t *fsec); extern void j2date(int jd, int *year, int *month, int *day); extern int date2j(int year, int month, int day); diff --git a/src/include/utils/exc.h b/src/include/utils/exc.h index 72a09e4874..8b219b51fa 100644 --- a/src/include/utils/exc.h +++ b/src/include/utils/exc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: exc.h,v 1.22 2001/11/05 17:46:36 momjian Exp $ + * $Id: exc.h,v 1.23 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -40,7 +40,7 @@ extern ExcFrame *ExcCurFrameP; /* These are not used anywhere 1998/6/15 */ #define ExcBegin() \ do { \ - ExcFrame exception; \ + ExcFrame exception; \ \ exception.link = ExcCurFrameP; \ if (sigsetjmp(exception.context, 1) == 0) \ diff --git a/src/interfaces/ecpg/preproc/c_keywords.c b/src/interfaces/ecpg/preproc/c_keywords.c index e057d5b5ec..68f2f112c5 100644 --- a/src/interfaces/ecpg/preproc/c_keywords.c +++ b/src/interfaces/ecpg/preproc/c_keywords.c @@ -23,12 +23,12 @@ static ScanKeyword ScanKeywords[] = { {"VARCHAR", VARCHAR}, {"auto", S_AUTO}, {"bool", SQL_BOOL}, - {"char", CHAR}, + {"char", CHAR_P}, {"const", S_CONST}, {"double", DOUBLE}, {"enum", SQL_ENUM}, {"extern", S_EXTERN}, - {"float", FLOAT}, + {"float", FLOAT_P}, {"int", INT}, {"long", SQL_LONG}, {"register", S_REGISTER}, diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c index 1a171908b4..ff52b97169 100644 --- a/src/interfaces/ecpg/preproc/keywords.c +++ b/src/interfaces/ecpg/preproc/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.48 2002/05/19 20:00:53 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.49 2002/06/11 13:40:52 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ static ScanKeyword ScanKeywords[] = { {"case", CASE}, {"cast", CAST}, {"chain", CHAIN}, - {"char", CHAR}, + {"char", CHAR_P}, {"character", CHARACTER}, {"characteristics", CHARACTERISTICS}, {"check", CHECK}, @@ -97,7 +97,7 @@ static ScanKeyword ScanKeywords[] = { {"deferrable", DEFERRABLE}, {"deferred", DEFERRED}, {"definer", DEFINER}, - {"delete", DELETE}, + {"delete", DELETE_P}, {"delimiters", DELIMITERS}, {"desc", DESC}, {"distinct", DISTINCT}, @@ -120,7 +120,7 @@ static ScanKeyword ScanKeywords[] = { {"extract", EXTRACT}, {"false", FALSE_P}, {"fetch", FETCH}, - {"float", FLOAT}, + {"float", FLOAT_P}, {"for", FOR}, {"force", FORCE}, {"foreign", FOREIGN}, @@ -131,7 +131,7 @@ static ScanKeyword ScanKeywords[] = { {"function", FUNCTION}, {"global", GLOBAL}, {"grant", GRANT}, - {"group", GROUP}, + {"group", GROUP_P}, {"handler", HANDLER}, {"having", HAVING}, {"hour", HOUR_P}, @@ -139,7 +139,7 @@ static ScanKeyword ScanKeywords[] = { {"immediate", IMMEDIATE}, {"immutable", IMMUTABLE}, {"implicit", IMPLICIT}, - {"in", IN}, + {"in", IN_P}, {"increment", INCREMENT}, {"index", INDEX}, {"inherits", INHERITS}, @@ -208,7 +208,7 @@ static ScanKeyword ScanKeywords[] = { {"option", OPTION}, {"or", OR}, {"order", ORDER}, - {"out", OUT}, + {"out", OUT_P}, {"outer", OUTER_P}, {"overlaps", OVERLAPS}, {"owner", OWNER}, diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index 49c7016b7a..103958089b 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.189 2002/05/20 09:29:41 meskes Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.190 2002/06/11 13:40:52 wieck Exp $ */ /* Copyright comment */ %{ @@ -184,24 +184,24 @@ make_name(void) BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH, BOOLEAN, BY, - CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR, CHARACTER, + CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR_P, CHARACTER, CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE, COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY, CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE, DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED, - DEFINER, DELETE, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP, + DEFINER, DELETE_P, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP, EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE, EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT, - FALSE_P, FETCH, FLOAT, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM, + FALSE_P, FETCH, FLOAT_P, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM, FULL, FUNCTION, - GLOBAL, GRANT, GROUP, + GLOBAL, GRANT, GROUP_P, HANDLER, HAVING, HOUR_P, - ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN, INCREMENT, INDEX, INHERITS, + ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN_P, INCREMENT, INDEX, INHERITS, INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT, INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION, @@ -218,7 +218,7 @@ make_name(void) NUMERIC, OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER, - OUT, OUTER_P, OVERLAPS, OWNER, + OUT_P, OUTER_P, OVERLAPS, OWNER, PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL, @@ -268,7 +268,7 @@ make_name(void) %nonassoc ESCAPE %nonassoc OVERLAPS %nonassoc BETWEEN -%nonassoc IN +%nonassoc IN_P %left POSTFIXOP /* dummy for postfix Op rules */ %left Op /* multi-character ops and user-defined operators */ %nonassoc NOTNULL @@ -713,7 +713,7 @@ OptUserElem: PASSWORD Sconst { $$ = make_str("createuser"); } | NOCREATEUSER { $$ = make_str("nocreateuser"); } - | IN GROUP user_list + | IN_P GROUP_P user_list { $$ = cat2_str(make_str("in group"), $3); } | VALID UNTIL Sconst { $$ = cat2_str(make_str("valid until"), $3); } @@ -731,9 +731,9 @@ user_list: user_list ',' UserId * * ****************************************************************************/ -CreateGroupStmt: CREATE GROUP UserId OptGroupList +CreateGroupStmt: CREATE GROUP_P UserId OptGroupList { $$ = cat_str(3, make_str("create group"), $3, $4); } - | CREATE GROUP UserId WITH OptGroupList + | CREATE GROUP_P UserId WITH OptGroupList { $$ = cat_str(4, make_str("create group"), $3, make_str("with"), $5); } ; @@ -757,9 +757,9 @@ OptGroupElem: USER user_list * * *****************************************************************************/ -AlterGroupStmt: ALTER GROUP UserId ADD USER user_list +AlterGroupStmt: ALTER GROUP_P UserId ADD USER user_list { $$ = cat_str(4, make_str("alter group"), $3, make_str("add user"), $6); } - | ALTER GROUP UserId DROP USER user_list + | ALTER GROUP_P UserId DROP USER user_list { $$ = cat_str(4, make_str("alter group"), $3, make_str("drop user"), $6); } ; @@ -769,7 +769,7 @@ AlterGroupStmt: ALTER GROUP UserId ADD USER user_list * * *****************************************************************************/ -DropGroupStmt: DROP GROUP UserId +DropGroupStmt: DROP GROUP_P UserId { $$ = cat2_str(make_str("drop group"), $3); } ; @@ -1234,7 +1234,7 @@ key_actions: key_delete { $$ = $1; } | /*EMPTY*/ { $$ = EMPTY; } ; -key_delete: ON DELETE key_reference +key_delete: ON DELETE_P key_reference { $$ = cat2_str(make_str("on delete"), $3); } ; @@ -1396,7 +1396,7 @@ TriggerEvents: TriggerOneEvent ; TriggerOneEvent: INSERT { $$ = make_str("insert"); } - | DELETE { $$ = make_str("delete"); } + | DELETE_P { $$ = make_str("delete"); } | UPDATE { $$ = make_str("update"); } ; @@ -1611,7 +1611,7 @@ fetch_how_many: IntConst { $$ = $1; } | PRIOR { $$ = make_str("prior"); } ; -from_in: IN { $$ = make_str("in"); } +from_in: IN_P { $$ = make_str("in"); } | FROM { $$ = make_str("from"); } ; @@ -1687,7 +1687,7 @@ privilege_list: privilege privilege: SELECT { $$ = make_str("select"); } | INSERT { $$ = make_str("insert"); } | UPDATE { $$ = make_str("update"); } - | DELETE { $$ = make_str("delete"); } + | DELETE_P { $$ = make_str("delete"); } | RULE { $$ = make_str("rule"); } | REFERENCES { $$ = make_str("references"); } | TRIGGER { $$ = make_str("trigger"); } @@ -1719,7 +1719,7 @@ grantee_list: grantee ; grantee: ColId { $$ = $1; } - | GROUP ColId { $$ = cat2_str(make_str("group"), $2); } + | GROUP_P ColId { $$ = cat2_str(make_str("group"), $2); } ; opt_grant_grant_option: WITH GRANT OPTION @@ -1854,8 +1854,8 @@ func_arg: opt_arg func_type | func_type { $$ = $1; } ; -opt_arg: IN { $$ = make_str("in"); } - | OUT +opt_arg: IN_P { $$ = make_str("in"); } + | OUT_P { mmerror(PARSE_ERROR, ET_WARNING, "Currently unsupported CREATE FUNCTION/OUT will be passed to backend"); @@ -2049,7 +2049,7 @@ RuleActionStmtOrEmpty: RuleActionStmt { $$ = $1; } /* change me to select, update, etc. some day */ event: SELECT { $$ = make_str("select"); } | UPDATE { $$ = make_str("update"); } - | DELETE { $$ = make_str("delete"); } + | DELETE_P { $$ = make_str("delete"); } | INSERT { $$ = make_str("insert"); } ; @@ -2354,7 +2354,7 @@ insert_column_item: ColId opt_indirection * *****************************************************************************/ -DeleteStmt: DELETE FROM relation_expr where_clause +DeleteStmt: DELETE_P FROM relation_expr where_clause { $$ = cat_str(3, make_str("delete from"), $3, $4); } ; @@ -2362,7 +2362,7 @@ LockStmt: LOCK_P opt_table qualified_name_list opt_lock { $$ = cat_str(4, make_str("lock"), $2, $3, $4); } ; -opt_lock: IN lock_type MODE +opt_lock: IN_P lock_type MODE { $$ = cat_str(3, make_str("in"), $2, make_str("mode")); } | /*EMPTY*/ { $$ = EMPTY;} @@ -2600,7 +2600,7 @@ select_offset_value: PosIntConst * ...however, recursive addattr and rename supported. make special * cases for these. */ -group_clause: GROUP BY expr_list +group_clause: GROUP_P BY expr_list { $$ = cat2_str(make_str("group by"), $3); } | /*EMPTY*/ { $$ = EMPTY; } @@ -2837,7 +2837,7 @@ Numeric: INT { $$ = make_str("bigint"); } | REAL { $$ = make_str("real"); } - | FLOAT opt_float + | FLOAT_P opt_float { $$ = cat2_str(make_str("float"), $2); } | DOUBLE PRECISION { $$ = make_str("double precision"); } @@ -2896,13 +2896,13 @@ Character: character '(' PosIntConst ')' opt_charset character: CHARACTER opt_varying { $$ = cat2_str(make_str("character"), $2); } - | CHAR opt_varying + | CHAR_P opt_varying { $$ = cat2_str(make_str("char"), $2); } | VARCHAR { $$ = make_str("varchar"); } | NATIONAL CHARACTER opt_varying { $$ = cat2_str(make_str("national character"), $3); } - | NATIONAL CHAR opt_varying + | NATIONAL CHAR_P opt_varying { $$ = cat2_str(make_str("national char"), $3); } | NCHAR opt_varying { $$ = cat2_str(make_str("nchar"), $2); } @@ -2975,9 +2975,9 @@ opt_interval: YEAR_P { $$ = make_str("year"); } * Define row_descriptor to allow yacc to break the reduce/reduce conflict * with singleton expressions. */ -row_expr: '(' row_descriptor ')' IN select_with_parens +row_expr: '(' row_descriptor ')' IN_P select_with_parens { $$ = cat_str(4, make_str("("), $2, make_str(") in "), $5); } - | '(' row_descriptor ')' NOT IN select_with_parens + | '(' row_descriptor ')' NOT IN_P select_with_parens { $$ = cat_str(4, make_str("("), $2, make_str(") not in "), $6); } | '(' row_descriptor ')' all_Op sub_type select_with_parens { $$ = cat_str(6, make_str("("), $2, make_str(")"), $4, $5, $6); } @@ -3140,9 +3140,9 @@ a_expr: c_expr { $$ = cat_str(5, $1, make_str("between"), $3, make_str("and"), $5); } | a_expr NOT BETWEEN b_expr AND b_expr %prec BETWEEN { $$ = cat_str(5, $1, make_str("not between"), $4, make_str("and"), $6); } - | a_expr IN in_expr + | a_expr IN_P in_expr { $$ = cat_str(3, $1, make_str(" in"), $3); } - | a_expr NOT IN in_expr + | a_expr NOT IN_P in_expr { $$ = cat_str(3, $1, make_str(" not in "), $4); } | a_expr all_Op sub_type select_with_parens %prec Op { $$ = cat_str(4, $1, $2, $3, $4); } @@ -3307,7 +3307,7 @@ extract_arg: IDENT { $$ = $1; } ; /* position_list uses b_expr not a_expr to avoid conflict with general IN */ -position_list: b_expr IN b_expr +position_list: b_expr IN_P b_expr { $$ = cat_str(3, $1, make_str("in"), $3); } | /* EMPTY */ { $$ = EMPTY; } @@ -4146,7 +4146,7 @@ unsigned_type: SQL_UNSIGNED SQL_SHORT { $$ = ECPGt_unsigned_short; } $$ = ECPGt_unsigned_long; #endif } - | SQL_UNSIGNED CHAR { $$ = ECPGt_unsigned_char; } + | SQL_UNSIGNED CHAR_P { $$ = ECPGt_unsigned_char; } ; signed_type: SQL_SHORT { $$ = ECPGt_short; } @@ -4171,7 +4171,7 @@ signed_type: SQL_SHORT { $$ = ECPGt_short; } #endif } | SQL_BOOL { $$ = ECPGt_bool; } - | CHAR { $$ = ECPGt_char; } + | CHAR_P { $$ = ECPGt_char; } ; opt_signed: SQL_SIGNED @@ -4823,7 +4823,7 @@ ColId: ident { $$ = $1; } | unreserved_keyword { $$ = $1; } | col_name_keyword { $$ = $1; } | ECPGKeywords { $$ = $1; } - | CHAR { $$ = make_str("char"); } + | CHAR_P { $$ = make_str("char"); } ; /* Type identifier --- names that can be type names. @@ -4847,7 +4847,7 @@ function_name: ident { $$ = $1; } */ ColLabel: ECPGColLabel { $$ = $1; } | ECPGTypeName { $$ = $1; } - | CHAR { $$ = make_str("char"); } + | CHAR_P { $$ = make_str("char"); } | INT { $$ = make_str("int"); } | UNION { $$ = make_str("union"); } ; @@ -4907,7 +4907,7 @@ unreserved_keyword: | DAY_P { $$ = make_str("day"); } | DECLARE { $$ = make_str("declare"); } | DEFERRED { $$ = make_str("deferred"); } - | DELETE { $$ = make_str("delete"); } + | DELETE_P { $$ = make_str("delete"); } | DELIMITERS { $$ = make_str("delimiters"); } | DOMAIN_P { $$ = make_str("domain"); } | DOUBLE { $$ = make_str("double"); } @@ -4963,7 +4963,7 @@ unreserved_keyword: | OIDS { $$ = make_str("oids"); } | OPERATOR { $$ = make_str("operator"); } | OPTION { $$ = make_str("option"); } - | OUT { $$ = make_str("out"); } + | OUT_P { $$ = make_str("out"); } | OWNER { $$ = make_str("owner"); } | PARTIAL { $$ = make_str("partial"); } | PASSWORD { $$ = make_str("password"); } @@ -5044,7 +5044,7 @@ col_name_keyword: BIGINT { $$ = make_str("bigint");} | BIT { $$ = make_str("bit"); } /* CHAR must be excluded from ECPGColLabel because of conflict with UNSIGNED - | CHAR { $$ = make_str("char"); } + | CHAR_P { $$ = make_str("char"); } */ | CHARACTER { $$ = make_str("character"); } | COALESCE { $$ = make_str("coalesce"); } @@ -5052,7 +5052,7 @@ col_name_keyword: | DECIMAL { $$ = make_str("decimal"); } | EXISTS { $$ = make_str("exists"); } | EXTRACT { $$ = make_str("extract"); } - | FLOAT { $$ = make_str("float"); } + | FLOAT_P { $$ = make_str("float"); } /* INT must be excluded from ECPGColLabel because of conflict | INT { $$ = make_str("int"); } */ @@ -5091,7 +5091,7 @@ func_name_keyword: | FREEZE { $$ = make_str("freeze"); } | FULL { $$ = make_str("full"); } | ILIKE { $$ = make_str("ilike"); } - | IN { $$ = make_str("in"); } + | IN_P { $$ = make_str("in"); } | INNER_P { $$ = make_str("inner"); } | IS { $$ = make_str("is"); } | ISNULL { $$ = make_str("isnull"); } @@ -5145,7 +5145,7 @@ reserved_keyword: | FOREIGN { $$ = make_str("foreign"); } | FROM { $$ = make_str("from"); } | GRANT { $$ = make_str("grant"); } - | GROUP { $$ = make_str("group"); } + | GROUP_P { $$ = make_str("group"); } | HAVING { $$ = make_str("having"); } | INITIALLY { $$ = make_str("initially"); } | INTERSECT { $$ = make_str("intersect"); } @@ -5305,9 +5305,9 @@ c_anything: IDENT { $$ = $1; } | SQL_SIGNED { $$ = make_str("signed"); } | SQL_STRUCT { $$ = make_str("struct"); } | SQL_UNSIGNED { $$ = make_str("unsigned"); } - | CHAR { $$ = make_str("char"); } + | CHAR_P { $$ = make_str("char"); } | DOUBLE { $$ = make_str("double"); } - | FLOAT { $$ = make_str("float"); } + | FLOAT_P { $$ = make_str("float"); } | UNION { $$ = make_str("union"); } | VARCHAR { $$ = make_str("varchar"); } | '[' { $$ = make_str("["); } diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 9beb235b33..1856499ebf 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -10,7 +10,7 @@ * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes). * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.65 2002/04/24 23:00:40 petere Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.66 2002/06/11 13:40:53 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -714,7 +714,7 @@ fe_getauthname(char *PQerrormsg) char username[128]; DWORD namesize = sizeof(username) - 1; - if (GetUserName(username, &namesize)) + if (GetUserNameFromId(username, &namesize)) name = username; #else struct passwd *pw = getpwuid(geteuid());