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
This commit is contained in:
Jan Wieck 2002-06-11 13:40:53 +00:00
parent 3b993acf19
commit 469cb65aca
34 changed files with 306 additions and 306 deletions

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* This file contains the high level access-method interface to the * 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 * 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: * Old comments:
* true if given transaction has neither committed nor aborted * true if given transaction has neither committed nor aborted

View File

@ -6,7 +6,7 @@
* Copyright (c) 2000, PostgreSQL Global Development Group * Copyright (c) 2000, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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 * Must set MyProc->xid before releasing XidGenLock. This ensures
* that when GetSnapshotData calls ReadNewTransactionId, all active * that when GetSnapshotData calls ReadNewTransactionId, all active
* XIDs before the returned value of nextXid are already present in * 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 * XXX by storing xid into MyProc without acquiring SInvalLock, we are
* relying on fetch/store of an xid to be atomic, else other backends * 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 * 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 * would be a nasty concurrency hit (and in fact could cause a
* deadlock against GetSnapshotData). So for now, assume atomicity. * 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 * value only once, rather than assume they can read it multiple times
* and get the same answer each time. * and get the same answer each time.
* *
* A solution to the atomic-store problem would be to give each PROC its * A solution to the atomic-store problem would be to give each PGPROC its
* own spinlock used only for fetching/storing that PROC's xid. * own spinlock used only for fetching/storing that PGPROC's xid.
* (SInvalLock would then mean primarily that PROCs couldn't be added/ * (SInvalLock would then mean primarily that PROCs couldn't be added/
* removed while holding the lock.) * removed while holding the lock.)
*/ */
if (MyProc != (PROC *) NULL) if (MyProc != (PGPROC *) NULL)
MyProc->xid = xid; MyProc->xid = xid;
LWLockRelease(XidGenLock); LWLockRelease(XidGenLock);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Transaction aborts can now occur two ways: * Transaction aborts can now occur two ways:
@ -602,7 +602,7 @@ RecordTransactionCommit(void)
MyLastRecPtr.xrecoff = 0; MyLastRecPtr.xrecoff = 0;
MyXactMadeXLogEntry = false; 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; MyProc->logRec.xrecoff = 0;
if (leak) if (leak)
@ -727,7 +727,7 @@ RecordTransactionAbort(void)
MyLastRecPtr.xrecoff = 0; MyLastRecPtr.xrecoff = 0;
MyXactMadeXLogEntry = false; 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; MyProc->logRec.xrecoff = 0;
/* /*
@ -960,7 +960,7 @@ CommitTransaction(void)
* as running as well or it will see two tuple versions - one deleted * 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. * 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. */ /* Lock SInvalLock because that's what GetSnapshotData uses. */
LWLockAcquire(SInvalLock, LW_EXCLUSIVE); LWLockAcquire(SInvalLock, LW_EXCLUSIVE);
@ -1069,7 +1069,7 @@ AbortTransaction(void)
* this must be done _before_ releasing locks we hold and _after_ * this must be done _before_ releasing locks we hold and _after_
* RecordTransactionAbort. * RecordTransactionAbort.
*/ */
if (MyProc != (PROC *) NULL) if (MyProc != (PGPROC *) NULL)
{ {
/* Lock SInvalLock because that's what GetSnapshotData uses. */ /* Lock SInvalLock because that's what GetSnapshotData uses. */
LWLockAcquire(SInvalLock, LW_EXCLUSIVE); LWLockAcquire(SInvalLock, LW_EXCLUSIVE);

View File

@ -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
* *
* $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 */ /* Compute record's XLOG location */
INSERT_RECPTR(RecPtr, Insert, curridx); 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) 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 * this while holding insert lock to ensure that we won't miss any
* about-to-commit transactions (UNDO must include all xacts that have * about-to-commit transactions (UNDO must include all xacts that have
* commits after REDO point). * commits after REDO point).

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 <ival> boot_tuple boot_tuplelist %type <ival> boot_tuple boot_tuplelist
%type <oidval> optoideq %type <oidval> optoideq
%token <ival> CONST ID %token <ival> CONST_P ID
%token OPEN XCLOSE XCREATE INSERT_TUPLE %token OPEN XCLOSE XCREATE INSERT_TUPLE
%token STRING XDEFINE %token STRING XDEFINE
%token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE %token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE
@ -329,7 +329,7 @@ boot_tuple:
; ;
boot_const : boot_const :
CONST { $$=yylval.ival; } CONST_P { $$=yylval.ival; }
; ;
boot_ident : boot_ident :

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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}*"."{D}+({Exp})? |
(-)?{D}+{Exp} { (-)?{D}+{Exp} {
yylval.ival = EnterString((char*)yytext); yylval.ival = EnterString((char*)yytext);
return(CONST); return(CONST_P);
} }
. { . {

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) if (!authId)
{ {
owner_userid = saved_userid; owner_userid = saved_userid;
owner_name = GetUserName(owner_userid); owner_name = GetUserNameFromId(owner_userid);
} }
else if (superuser()) else if (superuser())
{ {
@ -68,7 +68,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
else /* not superuser */ else /* not superuser */
{ {
owner_userid = saved_userid; owner_userid = saved_userid;
owner_name = GetUserName(owner_userid); owner_name = GetUserNameFromId(owner_userid);
if (strcmp(authId, owner_name) != 0) if (strcmp(authId, owner_name) != 0)
elog(ERROR, "CREATE SCHEMA: permission denied" elog(ERROR, "CREATE SCHEMA: permission denied"
"\n\t\"%s\" is not a superuser, so cannot create a schema for \"%s\"", "\n\t\"%s\" is not a superuser, so cannot create a schema for \"%s\"",

View File

@ -6,7 +6,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/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 && createuser < 0 &&
!validUntil && !validUntil &&
password && password &&
strcmp(GetUserName(GetUserId()), stmt->user) == 0)) strcmp(GetUserNameFromId(GetUserId()), stmt->user) == 0))
elog(ERROR, "ALTER USER: permission denied"); elog(ERROR, "ALTER USER: permission denied");
/* changes to the flat password file cannot be rolled back */ /* changes to the flat password file cannot be rolled back */

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * const char *
show_session_authorization(void) show_session_authorization(void)
{ {
return GetUserName(GetSessionUserId()); return GetUserNameFromId(GetSessionUserId());
} }

View File

@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * 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 * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
@ -321,25 +321,25 @@ static void doNegateFloat(Value *v);
BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH, BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
BOOLEAN, BY, 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, CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE,
COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY, COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY,
CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME, CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME,
CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,
DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED, 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, EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE,
EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT, 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, FULL, FUNCTION,
GLOBAL, GRANT, GROUP, GLOBAL, GRANT, GROUP_P,
HANDLER, HAVING, HOUR_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, INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT,
INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION, INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION,
@ -356,7 +356,7 @@ static void doNegateFloat(Value *v);
NUMERIC, NUMERIC,
OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER, 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, PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY,
PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL, PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL,
@ -406,7 +406,7 @@ static void doNegateFloat(Value *v);
%nonassoc ESCAPE %nonassoc ESCAPE
%nonassoc OVERLAPS %nonassoc OVERLAPS
%nonassoc BETWEEN %nonassoc BETWEEN
%nonassoc IN %nonassoc IN_P
%left POSTFIXOP /* dummy for postfix Op rules */ %left POSTFIXOP /* dummy for postfix Op rules */
%left Op OPERATOR /* multi-character ops and user-defined operators */ %left Op OPERATOR /* multi-character ops and user-defined operators */
%nonassoc NOTNULL %nonassoc NOTNULL
@ -647,7 +647,7 @@ OptUserElem: PASSWORD Sconst
$$->defname = "createuser"; $$->defname = "createuser";
$$->arg = (Node *)makeInteger(FALSE); $$->arg = (Node *)makeInteger(FALSE);
} }
| IN GROUP user_list | IN_P GROUP_P user_list
{ {
$$ = makeNode(DefElem); $$ = makeNode(DefElem);
$$->defname = "groupElts"; $$->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); CreateGroupStmt *n = makeNode(CreateGroupStmt);
n->name = $3; n->name = $3;
n->options = $4; n->options = $4;
$$ = (Node *)n; $$ = (Node *)n;
} }
| CREATE GROUP UserId WITH OptGroupList | CREATE GROUP_P UserId WITH OptGroupList
{ {
CreateGroupStmt *n = makeNode(CreateGroupStmt); CreateGroupStmt *n = makeNode(CreateGroupStmt);
n->name = $3; 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); AlterGroupStmt *n = makeNode(AlterGroupStmt);
n->name = $3; n->name = $3;
@ -733,7 +733,7 @@ AlterGroupStmt: ALTER GROUP UserId ADD USER user_list
n->listUsers = $6; n->listUsers = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER GROUP UserId DROP USER user_list | ALTER GROUP_P UserId DROP USER user_list
{ {
AlterGroupStmt *n = makeNode(AlterGroupStmt); AlterGroupStmt *n = makeNode(AlterGroupStmt);
n->name = $3; 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); DropGroupStmt *n = makeNode(DropGroupStmt);
n->name = $3; n->name = $3;
@ -1671,7 +1671,7 @@ key_actions: key_delete { $$ = $1; }
| /*EMPTY*/ { $$ = 0; } | /*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; } key_update: ON UPDATE key_reference { $$ = $3 << FKCONSTR_ON_UPDATE_SHIFT; }
@ -1963,7 +1963,7 @@ TriggerEvents: TriggerOneEvent
; ;
TriggerOneEvent: INSERT { $$ = 'i'; } TriggerOneEvent: INSERT { $$ = 'i'; }
| DELETE { $$ = 'd'; } | DELETE_P { $$ = 'd'; }
| UPDATE { $$ = 'u'; } | UPDATE { $$ = 'u'; }
; ;
@ -2472,7 +2472,7 @@ fetch_how_many: Iconst { $$ = $1; }
| PRIOR { $$ = -1; } | PRIOR { $$ = -1; }
; ;
from_in: IN { } from_in: IN_P { }
| FROM { } | FROM { }
; ;
@ -2524,7 +2524,7 @@ privilege_list: privilege { $$ = makeListi1($1); }
privilege: SELECT { $$ = ACL_SELECT; } privilege: SELECT { $$ = ACL_SELECT; }
| INSERT { $$ = ACL_INSERT; } | INSERT { $$ = ACL_INSERT; }
| UPDATE { $$ = ACL_UPDATE; } | UPDATE { $$ = ACL_UPDATE; }
| DELETE { $$ = ACL_DELETE; } | DELETE_P { $$ = ACL_DELETE; }
| RULE { $$ = ACL_RULE; } | RULE { $$ = ACL_RULE; }
| REFERENCES { $$ = ACL_REFERENCES; } | REFERENCES { $$ = ACL_REFERENCES; }
| TRIGGER { $$ = ACL_TRIGGER; } | TRIGGER { $$ = ACL_TRIGGER; }
@ -2598,7 +2598,7 @@ grantee: ColId
n->groupname = NULL; n->groupname = NULL;
$$ = (Node *)n; $$ = (Node *)n;
} }
| GROUP ColId | GROUP_P ColId
{ {
PrivGrantee *n = makeNode(PrivGrantee); PrivGrantee *n = makeNode(PrivGrantee);
/* Treat GROUP PUBLIC as a synonym for PUBLIC */ /* 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; $$ = FALSE;
} }
| OUT | OUT_P
{ {
elog(ERROR, "CREATE FUNCTION / OUT parameters are not supported"); elog(ERROR, "CREATE FUNCTION / OUT parameters are not supported");
$$ = TRUE; $$ = TRUE;
@ -3143,7 +3143,7 @@ RuleActionStmtOrEmpty: RuleActionStmt
/* change me to select, update, etc. some day */ /* change me to select, update, etc. some day */
event: SELECT { $$ = CMD_SELECT; } event: SELECT { $$ = CMD_SELECT; }
| UPDATE { $$ = CMD_UPDATE; } | UPDATE { $$ = CMD_UPDATE; }
| DELETE { $$ = CMD_DELETE; } | DELETE_P { $$ = CMD_DELETE; }
| INSERT { $$ = CMD_INSERT; } | 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); DeleteStmt *n = makeNode(DeleteStmt);
n->relation = $3; 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; } | /*EMPTY*/ { $$ = AccessExclusiveLock; }
; ;
@ -4134,7 +4134,7 @@ select_offset_value: Iconst
* cases for these. * cases for these.
*/ */
group_clause: GROUP BY expr_list { $$ = $3; } group_clause: GROUP_P BY expr_list { $$ = $3; }
| /*EMPTY*/ { $$ = NIL; } | /*EMPTY*/ { $$ = NIL; }
; ;
@ -4535,7 +4535,7 @@ Numeric: INT
{ {
$$ = SystemTypeName("float4"); $$ = SystemTypeName("float4");
} }
| FLOAT opt_float | FLOAT_P opt_float
{ {
$$ = $2; $$ = $2;
} }
@ -4726,10 +4726,10 @@ Character: character '(' Iconst ')' opt_charset
; ;
character: CHARACTER opt_varying { $$ = $2 ? "varchar": "bpchar"; } character: CHARACTER opt_varying { $$ = $2 ? "varchar": "bpchar"; }
| CHAR opt_varying { $$ = $2 ? "varchar": "bpchar"; } | CHAR_P opt_varying { $$ = $2 ? "varchar": "bpchar"; }
| VARCHAR { $$ = "varchar"; } | VARCHAR { $$ = "varchar"; }
| NATIONAL CHARACTER opt_varying { $$ = $3 ? "varchar": "bpchar"; } | 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"; } | 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 * Define row_descriptor to allow yacc to break the reduce/reduce conflict
* with singleton expressions. * with singleton expressions.
*/ */
row_expr: '(' row_descriptor ')' IN select_with_parens row_expr: '(' row_descriptor ')' IN_P select_with_parens
{ {
SubLink *n = makeNode(SubLink); SubLink *n = makeNode(SubLink);
n->lefthand = $2; n->lefthand = $2;
@ -4852,7 +4852,7 @@ row_expr: '(' row_descriptor ')' IN select_with_parens
n->subselect = $5; n->subselect = $5;
$$ = (Node *)n; $$ = (Node *)n;
} }
| '(' row_descriptor ')' NOT IN select_with_parens | '(' row_descriptor ')' NOT IN_P select_with_parens
{ {
SubLink *n = makeNode(SubLink); SubLink *n = makeNode(SubLink);
n->lefthand = $2; n->lefthand = $2;
@ -5190,7 +5190,7 @@ a_expr: c_expr
(Node *) makeSimpleA_Expr(OP, "<", $1, $4), (Node *) makeSimpleA_Expr(OP, "<", $1, $4),
(Node *) makeSimpleA_Expr(OP, ">", $1, $6)); (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 */ /* in_expr returns a SubLink or a list of a_exprs */
if (IsA($3, SubLink)) if (IsA($3, SubLink))
@ -5220,7 +5220,7 @@ a_expr: c_expr
$$ = n; $$ = 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 */ /* in_expr returns a SubLink or a list of a_exprs */
if (IsA($4, SubLink)) 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 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); } { $$ = makeList2($3, $1); }
| /*EMPTY*/ | /*EMPTY*/
{ $$ = NIL; } { $$ = NIL; }
@ -6242,7 +6242,7 @@ unreserved_keyword:
| DECLARE | DECLARE
| DEFERRED | DEFERRED
| DEFINER | DEFINER
| DELETE | DELETE_P
| DELIMITERS | DELIMITERS
| DOMAIN_P | DOMAIN_P
| DOUBLE | DOUBLE
@ -6303,7 +6303,7 @@ unreserved_keyword:
| OIDS | OIDS
| OPERATOR | OPERATOR
| OPTION | OPTION
| OUT | OUT_P
| OWNER | OWNER
| PARTIAL | PARTIAL
| PASSWORD | PASSWORD
@ -6389,14 +6389,14 @@ col_name_keyword:
BIGINT BIGINT
| BIT | BIT
| BOOLEAN | BOOLEAN
| CHAR | CHAR_P
| CHARACTER | CHARACTER
| COALESCE | COALESCE
| DEC | DEC
| DECIMAL | DECIMAL
| EXISTS | EXISTS
| EXTRACT | EXTRACT
| FLOAT | FLOAT_P
| INT | INT
| INTEGER | INTEGER
| INTERVAL | INTERVAL
@ -6433,7 +6433,7 @@ func_name_keyword:
| FREEZE | FREEZE
| FULL | FULL
| ILIKE | ILIKE
| IN | IN_P
| INNER_P | INNER_P
| IS | IS
| ISNULL | ISNULL
@ -6487,7 +6487,7 @@ reserved_keyword:
| FOREIGN | FOREIGN
| FROM | FROM
| GRANT | GRANT
| GROUP | GROUP_P
| HAVING | HAVING
| INITIALLY | INITIALLY
| INTERSECT | INTERSECT

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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}, {"case", CASE},
{"cast", CAST}, {"cast", CAST},
{"chain", CHAIN}, {"chain", CHAIN},
{"char", CHAR}, {"char", CHAR_P},
{"character", CHARACTER}, {"character", CHARACTER},
{"characteristics", CHARACTERISTICS}, {"characteristics", CHARACTERISTICS},
{"check", CHECK}, {"check", CHECK},
@ -97,7 +97,7 @@ static const ScanKeyword ScanKeywords[] = {
{"deferrable", DEFERRABLE}, {"deferrable", DEFERRABLE},
{"deferred", DEFERRED}, {"deferred", DEFERRED},
{"definer", DEFINER}, {"definer", DEFINER},
{"delete", DELETE}, {"delete", DELETE_P},
{"delimiters", DELIMITERS}, {"delimiters", DELIMITERS},
{"desc", DESC}, {"desc", DESC},
{"distinct", DISTINCT}, {"distinct", DISTINCT},
@ -120,7 +120,7 @@ static const ScanKeyword ScanKeywords[] = {
{"extract", EXTRACT}, {"extract", EXTRACT},
{"false", FALSE_P}, {"false", FALSE_P},
{"fetch", FETCH}, {"fetch", FETCH},
{"float", FLOAT}, {"float", FLOAT_P},
{"for", FOR}, {"for", FOR},
{"force", FORCE}, {"force", FORCE},
{"foreign", FOREIGN}, {"foreign", FOREIGN},
@ -131,7 +131,7 @@ static const ScanKeyword ScanKeywords[] = {
{"function", FUNCTION}, {"function", FUNCTION},
{"global", GLOBAL}, {"global", GLOBAL},
{"grant", GRANT}, {"grant", GRANT},
{"group", GROUP}, {"group", GROUP_P},
{"handler", HANDLER}, {"handler", HANDLER},
{"having", HAVING}, {"having", HAVING},
{"hour", HOUR_P}, {"hour", HOUR_P},
@ -139,7 +139,7 @@ static const ScanKeyword ScanKeywords[] = {
{"immediate", IMMEDIATE}, {"immediate", IMMEDIATE},
{"immutable", IMMUTABLE}, {"immutable", IMMUTABLE},
{"implicit", IMPLICIT}, {"implicit", IMPLICIT},
{"in", IN}, {"in", IN_P},
{"increment", INCREMENT}, {"increment", INCREMENT},
{"index", INDEX}, {"index", INDEX},
{"inherits", INHERITS}, {"inherits", INHERITS},
@ -208,7 +208,7 @@ static const ScanKeyword ScanKeywords[] = {
{"option", OPTION}, {"option", OPTION},
{"or", OR}, {"or", OR},
{"order", ORDER}, {"order", ORDER},
{"out", OUT}, {"out", OUT_P},
{"outer", OUTER_P}, {"outer", OUTER_P},
{"overlaps", OVERLAPS}, {"overlaps", OVERLAPS},
{"owner", OWNER}, {"owner", OWNER},

View File

@ -14,7 +14,7 @@
* *
* The postmaster process creates the shared memory and semaphore * The postmaster process creates the shared memory and semaphore
* pools during startup, but as a rule does not touch them itself. * 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 * and so it cannot participate in lock-manager operations. Keeping
* the postmaster away from shared memory operations makes it simpler * the postmaster away from shared memory operations makes it simpler
* and more reliable. The postmaster is almost always able to recover * and more reliable. The postmaster is almost always able to recover
@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* *

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * The routines later in this file that use shared mode are okay with
* this, because they aren't looking at the ProcState fields * this, because they aren't looking at the ProcState fields
* associated with SI message transfer; they only use the * 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); LWLockAcquire(SInvalLock, LW_SHARED);
getResult = SIGetDataEntry(shmInvalBuffer, MyBackendId, &data); 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 */ /* 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 */ /* direct relationship to shared-cache invalidation. But the procState */
/* array in the SI segment is the only place in the system where we have */ /* 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 */ /* 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 --- */ /* functions with a slow, ugly search through the ShmemIndex hash table --- */
/* now they are simple loops over the SI ProcState array. */ /* now they are simple loops over the SI ProcState array. */
/****************************************************************************/ /****************************************************************************/
@ -171,7 +171,7 @@ DatabaseHasActiveBackends(Oid databaseId, bool ignoreMyself)
if (pOffset != INVALID_OFFSET) if (pOffset != INVALID_OFFSET)
{ {
PROC *proc = (PROC *) MAKE_PTR(pOffset); PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset);
if (proc->databaseId == databaseId) if (proc->databaseId == databaseId)
{ {
@ -208,7 +208,7 @@ TransactionIdIsInProgress(TransactionId xid)
if (pOffset != INVALID_OFFSET) if (pOffset != INVALID_OFFSET)
{ {
PROC *proc = (PROC *) MAKE_PTR(pOffset); PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset);
/* Fetch xid just once - see GetNewTransactionId */ /* Fetch xid just once - see GetNewTransactionId */
TransactionId pxid = proc->xid; TransactionId pxid = proc->xid;
@ -260,7 +260,7 @@ GetOldestXmin(bool allDbs)
if (pOffset != INVALID_OFFSET) if (pOffset != INVALID_OFFSET)
{ {
PROC *proc = (PROC *) MAKE_PTR(pOffset); PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset);
if (allDbs || proc->databaseId == MyDatabaseId) if (allDbs || proc->databaseId == MyDatabaseId)
{ {
@ -371,7 +371,7 @@ GetSnapshotData(bool serializable)
if (pOffset != INVALID_OFFSET) if (pOffset != INVALID_OFFSET)
{ {
PROC *proc = (PROC *) MAKE_PTR(pOffset); PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset);
/* Fetch xid just once - see GetNewTransactionId */ /* Fetch xid just once - see GetNewTransactionId */
TransactionId xid = proc->xid; TransactionId xid = proc->xid;
@ -460,7 +460,7 @@ CountActiveBackends(void)
if (pOffset != INVALID_OFFSET) if (pOffset != INVALID_OFFSET)
{ {
PROC *proc = (PROC *) MAKE_PTR(pOffset); PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset);
if (proc == MyProc) if (proc == MyProc)
continue; /* do not count myself */ continue; /* do not count myself */
@ -476,7 +476,7 @@ CountActiveBackends(void)
} }
/* /*
* GetUndoRecPtr -- returns oldest PROC->logRec. * GetUndoRecPtr -- returns oldest PGPROC->logRec.
*/ */
XLogRecPtr XLogRecPtr
GetUndoRecPtr(void) GetUndoRecPtr(void)
@ -495,7 +495,7 @@ GetUndoRecPtr(void)
if (pOffset != INVALID_OFFSET) if (pOffset != INVALID_OFFSET)
{ {
PROC *proc = (PROC *) MAKE_PTR(pOffset); PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset);
tempr = proc->logRec; tempr = proc->logRec;
if (tempr.xrecoff == 0) 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 * 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 * knows that the backend isn't going to go away, so we do not bother with
* locking. * locking.
*/ */
struct PROC * struct PGPROC *
BackendIdGetProc(BackendId procId) BackendIdGetProc(BackendId procId)
{ {
SISeg *segP = shmInvalBuffer; SISeg *segP = shmInvalBuffer;
@ -530,7 +530,7 @@ BackendIdGetProc(BackendId procId)
if (pOffset != INVALID_OFFSET) if (pOffset != INVALID_OFFSET)
{ {
PROC *proc = (PROC *) MAKE_PTR(pOffset); PGPROC *proc = (PGPROC *) MAKE_PTR(pOffset);
return proc; return proc;
} }

View File

@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * 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: * Interface:
* *
@ -31,8 +31,8 @@
/* One edge in the waits-for graph */ /* One edge in the waits-for graph */
typedef struct typedef struct
{ {
PROC *waiter; /* the waiting process */ PGPROC *waiter; /* the waiting process */
PROC *blocker; /* the process it is waiting for */ PGPROC *blocker; /* the process it is waiting for */
int pred; /* workspace for TopoSort */ int pred; /* workspace for TopoSort */
int link; /* workspace for TopoSort */ int link; /* workspace for TopoSort */
} EDGE; } EDGE;
@ -41,20 +41,20 @@ typedef struct
typedef struct typedef struct
{ {
LOCK *lock; /* the lock whose wait queue is described */ 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; int nProcs;
} WAIT_ORDER; } WAIT_ORDER;
static bool DeadLockCheckRecurse(PROC *proc); static bool DeadLockCheckRecurse(PGPROC *proc);
static bool TestConfiguration(PROC *startProc); static bool TestConfiguration(PGPROC *startProc);
static bool FindLockCycle(PROC *checkProc, static bool FindLockCycle(PGPROC *checkProc,
EDGE *softEdges, int *nSoftEdges); EDGE *softEdges, int *nSoftEdges);
static bool FindLockCycleRecurse(PROC *checkProc, static bool FindLockCycleRecurse(PGPROC *checkProc,
EDGE *softEdges, int *nSoftEdges); EDGE *softEdges, int *nSoftEdges);
static bool ExpandConstraints(EDGE *constraints, int nConstraints); static bool ExpandConstraints(EDGE *constraints, int nConstraints);
static bool TopoSort(LOCK *lock, EDGE *constraints, int nConstraints, static bool TopoSort(LOCK *lock, EDGE *constraints, int nConstraints,
PROC **ordering); PGPROC **ordering);
#ifdef DEBUG_DEADLOCK #ifdef DEBUG_DEADLOCK
static void PrintLockQueue(LOCK *lock, const char *info); static void PrintLockQueue(LOCK *lock, const char *info);
@ -66,18 +66,18 @@ static void PrintLockQueue(LOCK *lock, const char *info);
*/ */
/* Workspace for FindLockCycle */ /* Workspace for FindLockCycle */
static PROC **visitedProcs; /* Array of visited procs */ static PGPROC **visitedProcs; /* Array of visited procs */
static int nVisitedProcs; static int nVisitedProcs;
/* Workspace for TopoSort */ /* 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 *beforeConstraints; /* Counts of remaining before-constraints */
static int *afterConstraints; /* List head for after-constraints */ static int *afterConstraints; /* List head for after-constraints */
/* Output area for ExpandConstraints */ /* Output area for ExpandConstraints */
static WAIT_ORDER *waitOrders; /* Array of proposed queue rearrangements */ static WAIT_ORDER *waitOrders; /* Array of proposed queue rearrangements */
static int nWaitOrders; 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 */ /* Current list of constraints being considered */
static EDGE *curConstraints; static EDGE *curConstraints;
@ -111,7 +111,7 @@ InitDeadLockChecking(void)
/* /*
* FindLockCycle needs at most MaxBackends entries in visitedProcs[] * 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, * TopoSort needs to consider at most MaxBackends wait-queue entries,
@ -128,7 +128,7 @@ InitDeadLockChecking(void)
* than MaxBackends total waiters. * than MaxBackends total waiters.
*/ */
waitOrders = (WAIT_ORDER *) palloc((MaxBackends / 2) * sizeof(WAIT_ORDER)); 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. * Allow at most MaxBackends distinct constraints in a configuration.
@ -176,7 +176,7 @@ InitDeadLockChecking(void)
* interlocked! * interlocked!
*/ */
bool bool
DeadLockCheck(PROC *proc) DeadLockCheck(PGPROC *proc)
{ {
int i, int i,
j; j;
@ -194,7 +194,7 @@ DeadLockCheck(PROC *proc)
for (i = 0; i < nWaitOrders; i++) for (i = 0; i < nWaitOrders; i++)
{ {
LOCK *lock = waitOrders[i].lock; LOCK *lock = waitOrders[i].lock;
PROC **procs = waitOrders[i].procs; PGPROC **procs = waitOrders[i].procs;
int nProcs = waitOrders[i].nProcs; int nProcs = waitOrders[i].nProcs;
PROC_QUEUE *waitQueue = &(lock->waitProcs); PROC_QUEUE *waitQueue = &(lock->waitProcs);
@ -234,7 +234,7 @@ DeadLockCheck(PROC *proc)
* rearrangements of lock wait queues (if any). * rearrangements of lock wait queues (if any).
*/ */
static bool static bool
DeadLockCheckRecurse(PROC *proc) DeadLockCheckRecurse(PGPROC *proc)
{ {
int nEdges; int nEdges;
int oldPossibleConstraints; int oldPossibleConstraints;
@ -300,7 +300,7 @@ DeadLockCheckRecurse(PROC *proc)
*-------------------- *--------------------
*/ */
static bool static bool
TestConfiguration(PROC *startProc) TestConfiguration(PGPROC *startProc)
{ {
int softFound = 0; int softFound = 0;
EDGE *softEdges = possibleConstraints + nPossibleConstraints; EDGE *softEdges = possibleConstraints + nPossibleConstraints;
@ -365,7 +365,7 @@ TestConfiguration(PROC *startProc)
* be believed in preference to the actual ordering seen in the locktable. * be believed in preference to the actual ordering seen in the locktable.
*/ */
static bool static bool
FindLockCycle(PROC *checkProc, FindLockCycle(PGPROC *checkProc,
EDGE *softEdges, /* output argument */ EDGE *softEdges, /* output argument */
int *nSoftEdges) /* output argument */ int *nSoftEdges) /* output argument */
{ {
@ -375,11 +375,11 @@ FindLockCycle(PROC *checkProc,
} }
static bool static bool
FindLockCycleRecurse(PROC *checkProc, FindLockCycleRecurse(PGPROC *checkProc,
EDGE *softEdges, /* output argument */ EDGE *softEdges, /* output argument */
int *nSoftEdges) /* output argument */ int *nSoftEdges) /* output argument */
{ {
PROC *proc; PGPROC *proc;
LOCK *lock; LOCK *lock;
HOLDER *holder; HOLDER *holder;
SHM_QUEUE *lockHolders; SHM_QUEUE *lockHolders;
@ -438,7 +438,7 @@ FindLockCycleRecurse(PROC *checkProc,
while (holder) while (holder)
{ {
proc = (PROC *) MAKE_PTR(holder->tag.proc); proc = (PGPROC *) MAKE_PTR(holder->tag.proc);
/* A proc never blocks itself */ /* A proc never blocks itself */
if (proc != checkProc) if (proc != checkProc)
@ -480,7 +480,7 @@ FindLockCycleRecurse(PROC *checkProc,
if (i < nWaitOrders) if (i < nWaitOrders)
{ {
/* Use the given hypothetical wait queue order */ /* Use the given hypothetical wait queue order */
PROC **procs = waitOrders[i].procs; PGPROC **procs = waitOrders[i].procs;
queue_size = waitOrders[i].nProcs; queue_size = waitOrders[i].nProcs;
@ -517,7 +517,7 @@ FindLockCycleRecurse(PROC *checkProc,
waitQueue = &(lock->waitProcs); waitQueue = &(lock->waitProcs);
queue_size = waitQueue->size; queue_size = waitQueue->size;
proc = (PROC *) MAKE_PTR(waitQueue->links.next); proc = (PGPROC *) MAKE_PTR(waitQueue->links.next);
while (queue_size-- > 0) 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 * specific new orderings for affected wait queues
* *
* Input is a list of soft edges to be reversed. The output is a list * 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[]. * workspace in waitOrderProcs[].
* *
* Returns TRUE if able to build an ordering that satisfies all the * Returns TRUE if able to build an ordering that satisfies all the
@ -582,7 +582,7 @@ ExpandConstraints(EDGE *constraints,
*/ */
for (i = nConstraints; --i >= 0;) for (i = nConstraints; --i >= 0;)
{ {
PROC *proc = constraints[i].waiter; PGPROC *proc = constraints[i].waiter;
LOCK *lock = proc->waitLock; LOCK *lock = proc->waitLock;
/* Did we already make a list for this lock? */ /* Did we already make a list for this lock? */
@ -628,7 +628,7 @@ ExpandConstraints(EDGE *constraints,
* slowness of the algorithm won't really matter. * slowness of the algorithm won't really matter.
* *
* The initial queue ordering is taken directly from the lock's wait queue. * 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). * wait queue length (the caller is responsible for providing this space).
* The partial order is specified by an array of EDGE structs. Each EDGE * 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 * is one that we need to reverse, therefore the "waiter" must appear before
@ -642,22 +642,22 @@ static bool
TopoSort(LOCK *lock, TopoSort(LOCK *lock,
EDGE *constraints, EDGE *constraints,
int nConstraints, int nConstraints,
PROC **ordering) /* output argument */ PGPROC **ordering) /* output argument */
{ {
PROC_QUEUE *waitQueue = &(lock->waitProcs); PROC_QUEUE *waitQueue = &(lock->waitProcs);
int queue_size = waitQueue->size; int queue_size = waitQueue->size;
PROC *proc; PGPROC *proc;
int i, int i,
j, j,
k, k,
last; last;
/* First, fill topoProcs[] array with the procs in their current order */ /* 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++) for (i = 0; i < queue_size; i++)
{ {
topoProcs[i] = proc; 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); PROC_QUEUE *waitQueue = &(lock->waitProcs);
int queue_size = waitQueue->size; int queue_size = waitQueue->size;
PROC *proc; PGPROC *proc;
int i; int i;
printf("%s lock %lx queue ", info, MAKE_OFFSET(lock)); 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++) for (i = 0; i < queue_size; i++)
{ {
printf(" %d", proc->pid); printf(" %d", proc->pid);
proc = (PROC *) MAKE_PTR(proc->links.next); proc = (PGPROC *) MAKE_PTR(proc->links.next);
} }
printf("\n"); printf("\n");
fflush(stdout); fflush(stdout);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Outside modules can create a lock table and acquire/release * 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, static int WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
LOCK *lock, HOLDER *holder); LOCK *lock, HOLDER *holder);
static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PGPROC *proc,
int *myHolding); int *myHolding);
static char *lock_mode_names[] = static char *lock_mode_names[] =
@ -746,7 +746,7 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
LOCKMODE lockmode, LOCKMODE lockmode,
LOCK *lock, LOCK *lock,
HOLDER *holder, HOLDER *holder,
PROC *proc, PGPROC *proc,
int *myHolding) /* myHolding[] array or NULL */ int *myHolding) /* myHolding[] array or NULL */
{ {
LOCKMETHODCTL *lockctl = lockMethodTable->ctl; LOCKMETHODCTL *lockctl = lockMethodTable->ctl;
@ -820,7 +820,7 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
* be a net slowdown. * be a net slowdown.
*/ */
static void static void
LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding) LockCountMyLocks(SHMEM_OFFSET lockOffset, PGPROC *proc, int *myHolding)
{ {
SHM_QUEUE *procHolders = &(proc->procHolders); SHM_QUEUE *procHolders = &(proc->procHolders);
HOLDER *holder; HOLDER *holder;
@ -944,7 +944,7 @@ WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
* this routine can only happen if we are aborting the transaction.) * this routine can only happen if we are aborting the transaction.)
*/ */
void void
RemoveFromWaitQueue(PROC *proc) RemoveFromWaitQueue(PGPROC *proc)
{ {
LOCK *waitLock = proc->waitLock; LOCK *waitLock = proc->waitLock;
LOCKMODE lockmode = proc->waitLockMode; LOCKMODE lockmode = proc->waitLockMode;
@ -1182,7 +1182,7 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
* specified XID are released. * specified XID are released.
*/ */
bool bool
LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
bool allxids, TransactionId xid) bool allxids, TransactionId xid)
{ {
SHM_QUEUE *procHolders = &(proc->procHolders); SHM_QUEUE *procHolders = &(proc->procHolders);
@ -1354,7 +1354,7 @@ LockShmemSize(int maxBackends)
long max_table_size = NLOCKENTS(maxBackends); long max_table_size = NLOCKENTS(maxBackends);
size += MAXALIGN(sizeof(PROC_HDR)); /* ProcGlobal */ 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 size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL)); /* each
* lockMethodTable->ctl */ * lockMethodTable->ctl */
@ -1383,7 +1383,7 @@ LockShmemSize(int maxBackends)
void void
DumpLocks(void) DumpLocks(void)
{ {
PROC *proc; PGPROC *proc;
SHM_QUEUE *procHolders; SHM_QUEUE *procHolders;
HOLDER *holder; HOLDER *holder;
LOCK *lock; LOCK *lock;
@ -1427,7 +1427,7 @@ DumpLocks(void)
void void
DumpAllLocks(void) DumpAllLocks(void)
{ {
PROC *proc; PGPROC *proc;
HOLDER *holder; HOLDER *holder;
LOCK *lock; LOCK *lock;
int lockmethod = DEFAULT_LOCKMETHOD; int lockmethod = DEFAULT_LOCKMETHOD;

View File

@ -15,7 +15,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/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 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 */ bool releaseOK; /* T if ok to release waiters */
char exclusive; /* # of exclusive holders (0 or 1) */ char exclusive; /* # of exclusive holders (0 or 1) */
int shared; /* # of shared holders (0..MaxBackends) */ int shared; /* # of shared holders (0..MaxBackends) */
PROC *head; /* head of list of waiting PROCs */ PGPROC *head; /* head of list of waiting PGPROCs */
PROC *tail; /* tail of list of waiting PROCs */ PGPROC *tail; /* tail of list of waiting PGPROCs */
/* tail is undefined when head is NULL */ /* tail is undefined when head is NULL */
} LWLock; } LWLock;
@ -197,7 +197,7 @@ void
LWLockAcquire(LWLockId lockid, LWLockMode mode) LWLockAcquire(LWLockId lockid, LWLockMode mode)
{ {
volatile LWLock *lock = LWLockArray + lockid; volatile LWLock *lock = LWLockArray + lockid;
PROC *proc = MyProc; PGPROC *proc = MyProc;
bool retry = false; bool retry = false;
int extraWaits = 0; int extraWaits = 0;
@ -266,12 +266,12 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
/* /*
* Add myself to wait queue. * 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 * should never occur, since MyProc should only be null during
* shared memory initialization. * shared memory initialization.
*/ */
if (proc == NULL) 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->lwWaiting = true;
proc->lwExclusive = (mode == LW_EXCLUSIVE); proc->lwExclusive = (mode == LW_EXCLUSIVE);
@ -401,8 +401,8 @@ void
LWLockRelease(LWLockId lockid) LWLockRelease(LWLockId lockid)
{ {
volatile LWLock *lock = LWLockArray + lockid; volatile LWLock *lock = LWLockArray + lockid;
PROC *head; PGPROC *head;
PROC *proc; PGPROC *proc;
int i; int i;
PRINT_LWDEBUG("LWLockRelease", lockid, lock); PRINT_LWDEBUG("LWLockRelease", lockid, lock);
@ -446,7 +446,7 @@ LWLockRelease(LWLockId lockid)
if (lock->exclusive == 0 && lock->shared == 0 && lock->releaseOK) 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. * front waiter wants exclusive lock, awaken him only.
* Otherwise awaken as many waiters as want shared access. * Otherwise awaken as many waiters as want shared access.
*/ */
@ -459,7 +459,7 @@ LWLockRelease(LWLockId lockid)
proc = proc->lwWaitLink; 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; lock->head = proc->lwWaitLink;
proc->lwWaitLink = NULL; proc->lwWaitLink = NULL;
/* prevent additional wakeups until retryer gets to run */ /* prevent additional wakeups until retryer gets to run */

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; 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 * 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 * relatively infrequently (only at backend startup or shutdown) and not for
* very long, so a spinlock is okay. * very long, so a spinlock is okay.
*/ */
@ -68,7 +68,7 @@ static slock_t *ProcStructLock = NULL;
static PROC_HDR *ProcGlobal = NULL; static PROC_HDR *ProcGlobal = NULL;
static PROC *DummyProc = NULL; static PGPROC *DummyProc = NULL;
static bool waitingForLock = false; static bool waitingForLock = false;
static bool waitingForSignal = false; static bool waitingForSignal = false;
@ -129,29 +129,29 @@ InitProcGlobal(int maxBackends)
ProcGlobal->freeProcs = INVALID_OFFSET; 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++) for (i = 0; i < maxBackends; i++)
{ {
PROC *proc; PGPROC *proc;
proc = (PROC *) ShmemAlloc(sizeof(PROC)); proc = (PGPROC *) ShmemAlloc(sizeof(PGPROC));
if (!proc) if (!proc)
elog(FATAL, "cannot create new proc: out of memory"); elog(FATAL, "cannot create new proc: out of memory");
MemSet(proc, 0, sizeof(PROC)); MemSet(proc, 0, sizeof(PGPROC));
PGSemaphoreCreate(&proc->sem); PGSemaphoreCreate(&proc->sem);
proc->links.next = ProcGlobal->freeProcs; proc->links.next = ProcGlobal->freeProcs;
ProcGlobal->freeProcs = MAKE_OFFSET(proc); 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. * too. This does not get linked into the freeProcs list.
*/ */
DummyProc = (PROC *) ShmemAlloc(sizeof(PROC)); DummyProc = (PGPROC *) ShmemAlloc(sizeof(PGPROC));
if (!DummyProc) if (!DummyProc)
elog(FATAL, "cannot create new proc: out of memory"); 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 */ DummyProc->pid = 0; /* marks DummyProc as not in use */
PGSemaphoreCreate(&DummyProc->sem); PGSemaphoreCreate(&DummyProc->sem);
@ -183,7 +183,7 @@ InitProcess(void)
/* /*
* Try to get a proc struct from the free list. If this fails, * 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); SpinLockAcquire(ProcStructLock);
@ -191,14 +191,14 @@ InitProcess(void)
if (myOffset != INVALID_OFFSET) if (myOffset != INVALID_OFFSET)
{ {
MyProc = (PROC *) MAKE_PTR(myOffset); MyProc = (PGPROC *) MAKE_PTR(myOffset);
procglobal->freeProcs = MyProc->links.next; procglobal->freeProcs = MyProc->links.next;
SpinLockRelease(ProcStructLock); SpinLockRelease(ProcStructLock);
} }
else 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 * the possible places to detect "too many backends", so give the
* standard error message. * standard error message.
*/ */
@ -236,7 +236,7 @@ InitProcess(void)
PGSemaphoreReset(&MyProc->sem); 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. * initialize the deadlock checker.
*/ */
InitDeadLockChecking(); InitDeadLockChecking();
@ -246,7 +246,7 @@ InitProcess(void)
* InitDummyProcess -- create a dummy per-process data structure * InitDummyProcess -- create a dummy per-process data structure
* *
* This is called by checkpoint processes so that they will have a MyProc * 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. * sema that are assigned are the extra ones created during InitProcGlobal.
*/ */
void void
@ -402,11 +402,11 @@ ProcKill(void)
SpinLockAcquire(ProcStructLock); SpinLockAcquire(ProcStructLock);
/* Return PROC structure (and semaphore) to freelist */ /* Return PGPROC structure (and semaphore) to freelist */
MyProc->links.next = procglobal->freeProcs; MyProc->links.next = procglobal->freeProcs;
procglobal->freeProcs = MAKE_OFFSET(MyProc); procglobal->freeProcs = MAKE_OFFSET(MyProc);
/* PROC struct isn't mine anymore */ /* PGPROC struct isn't mine anymore */
MyProc = NULL; MyProc = NULL;
SpinLockRelease(ProcStructLock); SpinLockRelease(ProcStructLock);
@ -414,7 +414,7 @@ ProcKill(void)
/* /*
* DummyProcKill() -- Cut-down version of ProcKill for dummy (checkpoint) * 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. * as not-in-use.
*/ */
static void static void
@ -433,7 +433,7 @@ DummyProcKill(void)
/* Mark DummyProc no longer in use */ /* Mark DummyProc no longer in use */
MyProc->pid = 0; MyProc->pid = 0;
/* PROC struct isn't mine anymore */ /* PGPROC struct isn't mine anymore */
MyProc = NULL; MyProc = NULL;
} }
@ -506,7 +506,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
PROC_QUEUE *waitQueue = &(lock->waitProcs); PROC_QUEUE *waitQueue = &(lock->waitProcs);
int myHeldLocks = MyProc->heldLocks; int myHeldLocks = MyProc->heldLocks;
bool early_deadlock = false; bool early_deadlock = false;
PROC *proc; PGPROC *proc;
int i; int i;
/* /*
@ -531,7 +531,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
{ {
int aheadRequests = 0; int aheadRequests = 0;
proc = (PROC *) MAKE_PTR(waitQueue->links.next); proc = (PGPROC *) MAKE_PTR(waitQueue->links.next);
for (i = 0; i < waitQueue->size; i++) for (i = 0; i < waitQueue->size; i++)
{ {
/* Must he wait for me? */ /* Must he wait for me? */
@ -568,7 +568,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
} }
/* Nope, so advance to next waiter */ /* Nope, so advance to next waiter */
aheadRequests |= (1 << proc->waitLockMode); 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 else
{ {
/* I hold no locks, so I can't push in front of anyone. */ /* 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); lock->waitMask |= (1 << lockmode);
/* Set up wait information in PROC object, too */ /* Set up wait information in PGPROC object, too */
MyProc->waitLock = lock; MyProc->waitLock = lock;
MyProc->waitHolder = holder; MyProc->waitHolder = holder;
MyProc->waitLockMode = lockmode; MyProc->waitLockMode = lockmode;
@ -685,20 +685,20 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
* works correctly for that case. To clean up in failure case, would need * works correctly for that case. To clean up in failure case, would need
* to twiddle the lock's request counts too --- see RemoveFromWaitQueue. * to twiddle the lock's request counts too --- see RemoveFromWaitQueue.
*/ */
PROC * PGPROC *
ProcWakeup(PROC *proc, int errType) ProcWakeup(PGPROC *proc, int errType)
{ {
PROC *retProc; PGPROC *retProc;
/* assume that masterLock has been acquired */ /* assume that masterLock has been acquired */
/* Proc should be sleeping ... */ /* Proc should be sleeping ... */
if (proc->links.prev == INVALID_OFFSET || if (proc->links.prev == INVALID_OFFSET ||
proc->links.next == INVALID_OFFSET) proc->links.next == INVALID_OFFSET)
return (PROC *) NULL; return (PGPROC *) NULL;
/* Save next process before we zap the list link */ /* 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 */ /* Remove process from wait queue */
SHMQueueDelete(&(proc->links)); SHMQueueDelete(&(proc->links));
@ -726,7 +726,7 @@ ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock)
LOCKMETHODCTL *lockctl = lockMethodTable->ctl; LOCKMETHODCTL *lockctl = lockMethodTable->ctl;
PROC_QUEUE *waitQueue = &(lock->waitProcs); PROC_QUEUE *waitQueue = &(lock->waitProcs);
int queue_size = waitQueue->size; int queue_size = waitQueue->size;
PROC *proc; PGPROC *proc;
int aheadRequests = 0; int aheadRequests = 0;
Assert(queue_size >= 0); Assert(queue_size >= 0);
@ -734,7 +734,7 @@ ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock)
if (queue_size == 0) if (queue_size == 0)
return; return;
proc = (PROC *) MAKE_PTR(waitQueue->links.next); proc = (PGPROC *) MAKE_PTR(waitQueue->links.next);
while (queue_size-- > 0) while (queue_size-- > 0)
{ {
@ -769,7 +769,7 @@ ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock)
* checks. * checks.
*/ */
aheadRequests |= (1 << lockmode); aheadRequests |= (1 << lockmode);
proc = (PROC *) MAKE_PTR(proc->links.next); proc = (PGPROC *) MAKE_PTR(proc->links.next);
} }
} }
@ -902,7 +902,7 @@ ProcCancelWaitForSignal(void)
void void
ProcSendSignal(BackendId procId) ProcSendSignal(BackendId procId)
{ {
PROC *proc = BackendIdGetProc(procId); PGPROC *proc = BackendIdGetProc(procId);
if (proc != NULL) if (proc != NULL)
PGSemaphoreUnlock(&proc->sem); PGSemaphoreUnlock(&proc->sem);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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: case DTK_CURRENT:
elog(ERROR, "Date CURRENT no longer supported" elog(ERROR, "Date CURRENT no longer supported"
"\n\tdate_in() internal coding error"); "\n\tdate_in() internal coding error");
GetCurrentTime(tm); GetCurrentDateTime(tm);
break; break;
case DTK_EPOCH: case DTK_EPOCH:
@ -1697,7 +1697,7 @@ time_timetz(PG_FUNCTION_ARGS)
fsec_t fsec; fsec_t fsec;
int tz; int tz;
GetCurrentTime(tm); GetCurrentDateTime(tm);
time2tm(time, tm, &fsec); time2tm(time, tm, &fsec);
tz = DetermineLocalTimeZone(tm); tz = DetermineLocalTimeZone(tm);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 */ {"acst", DTZ, NEG(24)}, /* Atlantic/Porto Acre */
{"act", TZ, NEG(30)}, /* Atlantic/Porto Acre */ {"act", TZ, NEG(30)}, /* Atlantic/Porto Acre */
{DA_D, ADBC, AD}, /* "ad" for years >= 0 */ {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 */ {"adt", DTZ, NEG(18)}, /* Atlantic Daylight Time */
{"aesst", DTZ, 66}, /* E. Australia */ {"aesst", DTZ, 66}, /* E. Australia */
{"aest", TZ, 60}, /* Australia Eastern Std Time */ {"aest", TZ, 60}, /* Australia Eastern Std Time */
@ -115,7 +115,7 @@ ast /* Atlantic Standard Time, Arabia Standard Time, Acre Standard Time */
{"apr", MONTH, 4}, {"apr", MONTH, 4},
{"april", MONTH, 4}, {"april", MONTH, 4},
{"ast", TZ, NEG(24)}, /* Atlantic Std Time (Canada) */ {"ast", TZ, NEG(24)}, /* Atlantic Std Time (Canada) */
{"at", IGNORE, 0}, /* "at" (throwaway) */ {"at", IGNORE_DTF, 0}, /* "at" (throwaway) */
{"aug", MONTH, 8}, {"aug", MONTH, 8},
{"august", MONTH, 8}, {"august", MONTH, 8},
{"awsst", DTZ, 54}, /* W. Australia */ {"awsst", DTZ, 54}, /* W. Australia */
@ -348,7 +348,7 @@ ncst
{"october", MONTH, 10}, {"october", MONTH, 10},
{"omsst", DTZ, 42}, /* Omsk Summer Time */ {"omsst", DTZ, 42}, /* Omsk Summer Time */
{"omst", TZ, 36}, /* Omsk Time */ {"omst", TZ, 36}, /* Omsk Time */
{"on", IGNORE, 0}, /* "on" (throwaway) */ {"on", IGNORE_DTF, 0}, /* "on" (throwaway) */
{"pdt", DTZ, NEG(42)}, /* Pacific Daylight Time */ {"pdt", DTZ, NEG(42)}, /* Pacific Daylight Time */
#if 0 #if 0
pest pest
@ -494,7 +494,7 @@ sizeof australian_datetktbl[0];
static datetkn deltatktbl[] = { static datetkn deltatktbl[] = {
/* text, token, lexval */ /* text, token, lexval */
{"@", IGNORE, 0}, /* postgres relative prefix */ {"@", IGNORE_DTF, 0}, /* postgres relative prefix */
{DAGO, AGO, 0}, /* "ago" indicates negative time offset */ {DAGO, AGO, 0}, /* "ago" indicates negative time offset */
{"c", UNITS, DTK_CENTURY}, /* "century" relative */ {"c", UNITS, DTK_CENTURY}, /* "century" relative */
{"cent", UNITS, DTK_CENTURY}, /* "century" relative */ {"cent", UNITS, DTK_CENTURY}, /* "century" relative */
@ -536,7 +536,7 @@ static datetkn deltatktbl[] = {
{"msecs", UNITS, DTK_MILLISEC}, {"msecs", UNITS, DTK_MILLISEC},
{"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative */ {"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative */
{DQUARTER, 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}, {"s", UNITS, DTK_SECOND},
{"sec", UNITS, DTK_SECOND}, {"sec", UNITS, DTK_SECOND},
{DSECOND, UNITS, DTK_SECOND}, {DSECOND, UNITS, DTK_SECOND},
@ -1198,7 +1198,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
case DTK_STRING: case DTK_STRING:
case DTK_SPECIAL: case DTK_SPECIAL:
type = DecodeSpecial(i, field[i], &val); type = DecodeSpecial(i, field[i], &val);
if (type == IGNORE) if (type == IGNORE_DTF)
continue; continue;
tmask = DTK_M(type); tmask = DTK_M(type);
@ -1223,7 +1223,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
case DTK_YESTERDAY: case DTK_YESTERDAY:
tmask = DTK_DATE_M; tmask = DTK_DATE_M;
*dtype = DTK_DATE; *dtype = DTK_DATE;
GetCurrentTime(tm); GetCurrentDateTime(tm);
j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1), j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1),
&tm->tm_year, &tm->tm_mon, &tm->tm_mday); &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
tm->tm_hour = 0; tm->tm_hour = 0;
@ -1234,7 +1234,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
case DTK_TODAY: case DTK_TODAY:
tmask = DTK_DATE_M; tmask = DTK_DATE_M;
*dtype = DTK_DATE; *dtype = DTK_DATE;
GetCurrentTime(tm); GetCurrentDateTime(tm);
tm->tm_hour = 0; tm->tm_hour = 0;
tm->tm_min = 0; tm->tm_min = 0;
tm->tm_sec = 0; tm->tm_sec = 0;
@ -1243,7 +1243,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
case DTK_TOMORROW: case DTK_TOMORROW:
tmask = DTK_DATE_M; tmask = DTK_DATE_M;
*dtype = DTK_DATE; *dtype = DTK_DATE;
GetCurrentTime(tm); GetCurrentDateTime(tm);
j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1), j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1),
&tm->tm_year, &tm->tm_mon, &tm->tm_mday); &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
tm->tm_hour = 0; tm->tm_hour = 0;
@ -1319,7 +1319,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
ftype[i] = DTK_TZ; ftype[i] = DTK_TZ;
break; break;
case IGNORE: case IGNORE_DTF:
break; break;
case AMPM: case AMPM:
@ -1815,7 +1815,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
case DTK_STRING: case DTK_STRING:
case DTK_SPECIAL: case DTK_SPECIAL:
type = DecodeSpecial(i, field[i], &val); type = DecodeSpecial(i, field[i], &val);
if (type == IGNORE) if (type == IGNORE_DTF)
continue; continue;
tmask = DTK_M(type); tmask = DTK_M(type);
@ -1885,7 +1885,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
ftype[i] = DTK_TZ; ftype[i] = DTK_TZ;
break; break;
case IGNORE: case IGNORE_DTF:
break; break;
case AMPM: case AMPM:
@ -1967,7 +1967,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
if ((fmask & DTK_DATE_M) == 0) if ((fmask & DTK_DATE_M) == 0)
{ {
GetCurrentTime(tmp); GetCurrentDateTime(tmp);
} }
else else
{ {
@ -2043,7 +2043,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
if (isalpha((unsigned char) *field[i])) if (isalpha((unsigned char) *field[i]))
{ {
type = DecodeSpecial(i, field[i], &val); type = DecodeSpecial(i, field[i], &val);
if (type == IGNORE) if (type == IGNORE_DTF)
continue; continue;
dmask = DTK_M(type); dmask = DTK_M(type);
@ -2576,7 +2576,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
*dtype = DTK_DELTA; *dtype = DTK_DELTA;
type = IGNORE; type = IGNORE_DTF;
tm->tm_year = 0; tm->tm_year = 0;
tm->tm_mon = 0; tm->tm_mon = 0;
tm->tm_mday = 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); tmask = DTK_M(TZ);
break; break;
} }
else if (type == IGNORE) else if (type == IGNORE_DTF)
{ {
if (*cp == '.') if (*cp == '.')
{ {
@ -2658,7 +2658,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
case DTK_NUMBER: case DTK_NUMBER:
val = strtol(field[i], &cp, 10); val = strtol(field[i], &cp, 10);
if (type == IGNORE) if (type == IGNORE_DTF)
type = DTK_SECOND; type = DTK_SECOND;
if (*cp == '.') if (*cp == '.')
@ -2826,7 +2826,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
case DTK_STRING: case DTK_STRING:
case DTK_SPECIAL: case DTK_SPECIAL:
type = DecodeUnits(i, field[i], &val); type = DecodeUnits(i, field[i], &val);
if (type == IGNORE) if (type == IGNORE_DTF)
continue; continue;
tmask = 0; /* DTK_M(type); */ tmask = 0; /* DTK_M(type); */

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* *
@ -239,14 +239,14 @@ GetCurrentAbsoluteTimeUsec(int *usec)
void void
GetCurrentTime(struct tm * tm) GetCurrentDateTime(struct tm * tm)
{ {
int tz; int tz;
abstime2tm(GetCurrentTransactionStartTime(), &tz, tm, NULL); abstime2tm(GetCurrentTransactionStartTime(), &tz, tm, NULL);
return; return;
} /* GetCurrentTime() */ } /* GetCurrentDateTime() */
void void

View File

@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * 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 Datum
current_user(PG_FUNCTION_ARGS) current_user(PG_FUNCTION_ARGS)
{ {
PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserName(GetUserId())))); PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserNameFromId(GetUserId()))));
} }
Datum Datum
session_user(PG_FUNCTION_ARGS) session_user(PG_FUNCTION_ARGS)
{ {
PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserName(GetSessionUserId())))); PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserNameFromId(GetSessionUserId()))));
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * Get user name from user id
*/ */
char * char *
GetUserName(Oid userid) GetUserNameFromId(Oid userid)
{ {
HeapTuple tuple; HeapTuple tuple;
char *result; char *result;

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * know MyDatabaseId before we can do this, since it's entered into
* the PROC struct.) * the PGPROC struct.)
*/ */
InitProcess(); InitProcess();

View File

@ -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.104 2002/05/17 01:19:19 tgl Exp $ * $Id: miscadmin.h,v 1.105 2002/06/11 13:40:52 wieck 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
@ -203,7 +203,7 @@ extern char *ExpandDatabasePath(const char *path);
extern void SetDatabaseName(const char *name); extern void SetDatabaseName(const char *name);
extern void SetDatabasePath(const char *path); extern void SetDatabasePath(const char *path);
extern char *GetUserName(Oid userid); extern char *GetUserNameFromId(Oid userid);
extern Oid GetUserId(void); extern Oid GetUserId(void);
extern void SetUserId(Oid userid); extern void SetUserId(Oid userid);

View File

@ -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: 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 */ /* originally in procq.h */
typedef struct PROC_QUEUE 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 */ int size; /* number of entries in list */
} PROC_QUEUE; } PROC_QUEUE;
/* struct PROC is declared in storage/proc.h, but must forward-reference it */ /* struct PGPROC is declared in storage/proc.h, but must forward-reference it */
typedef struct PROC PROC; typedef struct PGPROC PGPROC;
extern int max_locks_per_xact; extern int max_locks_per_xact;
@ -161,7 +161,7 @@ typedef struct LOCK
int grantMask; /* bitmask for lock types already granted */ int grantMask; /* bitmask for lock types already granted */
int waitMask; /* bitmask for lock types awaited */ int waitMask; /* bitmask for lock types awaited */
SHM_QUEUE lockHolders; /* list of HOLDER objects assoc. with lock */ 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 int requested[MAX_LOCKMODES]; /* counts of requested
* locks */ * locks */
int nRequested; /* total of requested[] array */ int nRequested; /* total of requested[] array */
@ -181,8 +181,8 @@ typedef struct LOCK
* holder hashtable. A HOLDERTAG value uniquely identifies a lock holder. * holder hashtable. A HOLDERTAG value uniquely identifies a lock holder.
* *
* There are two possible kinds of holder tags: a transaction (identified * 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 * both by the PGPROC of the backend running it, and the xact's own ID) and
* a session (identified by backend PROC, with xid = InvalidTransactionId). * a session (identified by backend PGPROC, with xid = InvalidTransactionId).
* *
* Currently, session holders are used for user locks and for cross-xact * Currently, session holders are used for user locks and for cross-xact
* locks obtained for VACUUM. We assume that a session lock never conflicts * locks obtained for VACUUM. We assume that a session lock never conflicts
@ -195,15 +195,15 @@ typedef struct LOCK
* as soon as convenient. * as soon as convenient.
* *
* Each HOLDER object is linked into lists for both the associated LOCK object * 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. * 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. * the lock's waitProcs queue.
*/ */
typedef struct HOLDERTAG typedef struct HOLDERTAG
{ {
SHMEM_OFFSET lock; /* link to per-lockable-object information */ 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 */ TransactionId xid; /* xact ID, or InvalidTransactionId */
} HOLDERTAG; } HOLDERTAG;
@ -235,16 +235,16 @@ extern bool LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
TransactionId xid, LOCKMODE lockmode, bool dontWait); TransactionId xid, LOCKMODE lockmode, bool dontWait);
extern bool LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, extern bool LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
TransactionId xid, LOCKMODE lockmode); TransactionId xid, LOCKMODE lockmode);
extern bool LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, extern bool LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
bool allxids, TransactionId xid); bool allxids, TransactionId xid);
extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
LOCKMODE lockmode, LOCKMODE lockmode,
LOCK *lock, HOLDER *holder, PROC *proc, LOCK *lock, HOLDER *holder, PGPROC *proc,
int *myHolding); int *myHolding);
extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode); 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 int LockShmemSize(int maxBackends);
extern bool DeadLockCheck(PROC *proc); extern bool DeadLockCheck(PGPROC *proc);
extern void InitDeadLockChecking(void); extern void InitDeadLockChecking(void);
#ifdef LOCK_DEBUG #ifdef LOCK_DEBUG

View File

@ -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: 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 * Each backend has a PGPROC struct in shared memory. There is also a list of
* currently-unused PROC structs that will be reallocated to new backends. * 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, * links: list link for any list the PGPROC is in. When waiting for a lock,
* the PROC is linked into that lock's waitProcs queue. A recycled PROC * the PGPROC is linked into that lock's waitProcs queue. A recycled PGPROC
* is linked into ProcGlobal's freeProcs list. * is linked into ProcGlobal's freeProcs list.
*/ */
struct PROC struct PGPROC
{ {
/* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */ /* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */
SHM_QUEUE links; /* list link if process is in a list */ 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. */ /* Info about LWLock the process is currently waiting for, if any. */
bool lwWaiting; /* true if waiting for an LW lock */ bool lwWaiting; /* true if waiting for an LW lock */
bool lwExclusive; /* true if waiting for exclusive access */ 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. */ /* Info about lock the process is currently waiting for, if any. */
/* waitLock and waitHolder are NULL if not currently waiting. */ /* waitLock and waitHolder are NULL if not currently waiting. */
@ -70,10 +70,10 @@ struct PROC
* or awaited by this backend */ * 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 typedef struct PROC_HDR
{ {
/* Head of list of free PROC structures */ /* Head of list of free PGPROC structures */
SHMEM_OFFSET freeProcs; SHMEM_OFFSET freeProcs;
} PROC_HDR; } PROC_HDR;
@ -102,7 +102,7 @@ extern void ProcReleaseLocks(bool isCommit);
extern void ProcQueueInit(PROC_QUEUE *queue); extern void ProcQueueInit(PROC_QUEUE *queue);
extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode, extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode,
LOCK *lock, HOLDER *holder); 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 void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock);
extern bool LockWaitCancel(void); extern bool LockWaitCancel(void);
extern void HandleDeadLock(SIGNAL_ARGS); extern void HandleDeadLock(SIGNAL_ARGS);

View File

@ -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: 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 TransactionId GetOldestXmin(bool allDbs);
extern int CountActiveBackends(void); extern int CountActiveBackends(void);
/* Use "struct PROC", not PROC, to avoid including proc.h here */ /* Use "struct PGPROC", not PGPROC, to avoid including proc.h here */
extern struct PROC *BackendIdGetProc(BackendId procId); extern struct PGPROC *BackendIdGetProc(BackendId procId);
#endif /* SINVAL_H */ #endif /* SINVAL_H */

View File

@ -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: 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. */ /* nextMsgNum is -1 in an inactive ProcState array entry. */
int nextMsgNum; /* next message number to read, or -1 */ int nextMsgNum; /* next message number to read, or -1 */
bool resetState; /* true, if backend has to reset its state */ 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; } ProcState;
/* Shared cache invalidation memory segment */ /* Shared cache invalidation memory segment */

View File

@ -9,7 +9,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: 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 TZ 5
#define DTZ 6 #define DTZ 6
#define DTZMOD 7 #define DTZMOD 7
#define IGNORE 8 #define IGNORE_DTF 8
#define AMPM 9 #define AMPM 9
#define HOUR 10 #define HOUR 10
#define MINUTE 11 #define MINUTE 11
@ -260,7 +260,7 @@ extern int day_tab[2][13];
|| (((m) == UTIME_MAXMONTH) && ((d) <= UTIME_MAXDAY)))))) || (((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 GetCurrentTimeUsec(struct tm * tm, fsec_t *fsec);
extern void j2date(int jd, int *year, int *month, int *day); extern void j2date(int jd, int *year, int *month, int *day);
extern int date2j(int year, int month, int day); extern int date2j(int year, int month, int day);

View File

@ -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: 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 */ /* These are not used anywhere 1998/6/15 */
#define ExcBegin() \ #define ExcBegin() \
do { \ do { \
ExcFrame exception; \ ExcFrame exception; \
\ \
exception.link = ExcCurFrameP; \ exception.link = ExcCurFrameP; \
if (sigsetjmp(exception.context, 1) == 0) \ if (sigsetjmp(exception.context, 1) == 0) \

View File

@ -23,12 +23,12 @@ static ScanKeyword ScanKeywords[] = {
{"VARCHAR", VARCHAR}, {"VARCHAR", VARCHAR},
{"auto", S_AUTO}, {"auto", S_AUTO},
{"bool", SQL_BOOL}, {"bool", SQL_BOOL},
{"char", CHAR}, {"char", CHAR_P},
{"const", S_CONST}, {"const", S_CONST},
{"double", DOUBLE}, {"double", DOUBLE},
{"enum", SQL_ENUM}, {"enum", SQL_ENUM},
{"extern", S_EXTERN}, {"extern", S_EXTERN},
{"float", FLOAT}, {"float", FLOAT_P},
{"int", INT}, {"int", INT},
{"long", SQL_LONG}, {"long", SQL_LONG},
{"register", S_REGISTER}, {"register", S_REGISTER},

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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}, {"case", CASE},
{"cast", CAST}, {"cast", CAST},
{"chain", CHAIN}, {"chain", CHAIN},
{"char", CHAR}, {"char", CHAR_P},
{"character", CHARACTER}, {"character", CHARACTER},
{"characteristics", CHARACTERISTICS}, {"characteristics", CHARACTERISTICS},
{"check", CHECK}, {"check", CHECK},
@ -97,7 +97,7 @@ static ScanKeyword ScanKeywords[] = {
{"deferrable", DEFERRABLE}, {"deferrable", DEFERRABLE},
{"deferred", DEFERRED}, {"deferred", DEFERRED},
{"definer", DEFINER}, {"definer", DEFINER},
{"delete", DELETE}, {"delete", DELETE_P},
{"delimiters", DELIMITERS}, {"delimiters", DELIMITERS},
{"desc", DESC}, {"desc", DESC},
{"distinct", DISTINCT}, {"distinct", DISTINCT},
@ -120,7 +120,7 @@ static ScanKeyword ScanKeywords[] = {
{"extract", EXTRACT}, {"extract", EXTRACT},
{"false", FALSE_P}, {"false", FALSE_P},
{"fetch", FETCH}, {"fetch", FETCH},
{"float", FLOAT}, {"float", FLOAT_P},
{"for", FOR}, {"for", FOR},
{"force", FORCE}, {"force", FORCE},
{"foreign", FOREIGN}, {"foreign", FOREIGN},
@ -131,7 +131,7 @@ static ScanKeyword ScanKeywords[] = {
{"function", FUNCTION}, {"function", FUNCTION},
{"global", GLOBAL}, {"global", GLOBAL},
{"grant", GRANT}, {"grant", GRANT},
{"group", GROUP}, {"group", GROUP_P},
{"handler", HANDLER}, {"handler", HANDLER},
{"having", HAVING}, {"having", HAVING},
{"hour", HOUR_P}, {"hour", HOUR_P},
@ -139,7 +139,7 @@ static ScanKeyword ScanKeywords[] = {
{"immediate", IMMEDIATE}, {"immediate", IMMEDIATE},
{"immutable", IMMUTABLE}, {"immutable", IMMUTABLE},
{"implicit", IMPLICIT}, {"implicit", IMPLICIT},
{"in", IN}, {"in", IN_P},
{"increment", INCREMENT}, {"increment", INCREMENT},
{"index", INDEX}, {"index", INDEX},
{"inherits", INHERITS}, {"inherits", INHERITS},
@ -208,7 +208,7 @@ static ScanKeyword ScanKeywords[] = {
{"option", OPTION}, {"option", OPTION},
{"or", OR}, {"or", OR},
{"order", ORDER}, {"order", ORDER},
{"out", OUT}, {"out", OUT_P},
{"outer", OUTER_P}, {"outer", OUTER_P},
{"overlaps", OVERLAPS}, {"overlaps", OVERLAPS},
{"owner", OWNER}, {"owner", OWNER},

View File

@ -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 */ /* Copyright comment */
%{ %{
@ -184,24 +184,24 @@ make_name(void)
BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH, BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
BOOLEAN, BY, 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, CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE,
COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY, COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY,
CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME, CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME,
CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,
DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED, 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, EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE,
EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT, 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, FULL, FUNCTION,
GLOBAL, GRANT, GROUP, GLOBAL, GRANT, GROUP_P,
HANDLER, HAVING, HOUR_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, INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT,
INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION, INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION,
@ -218,7 +218,7 @@ make_name(void)
NUMERIC, NUMERIC,
OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER, 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, PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY,
PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL, PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL,
@ -268,7 +268,7 @@ make_name(void)
%nonassoc ESCAPE %nonassoc ESCAPE
%nonassoc OVERLAPS %nonassoc OVERLAPS
%nonassoc BETWEEN %nonassoc BETWEEN
%nonassoc IN %nonassoc IN_P
%left POSTFIXOP /* dummy for postfix Op rules */ %left POSTFIXOP /* dummy for postfix Op rules */
%left Op /* multi-character ops and user-defined operators */ %left Op /* multi-character ops and user-defined operators */
%nonassoc NOTNULL %nonassoc NOTNULL
@ -713,7 +713,7 @@ OptUserElem: PASSWORD Sconst
{ $$ = make_str("createuser"); } { $$ = make_str("createuser"); }
| NOCREATEUSER | NOCREATEUSER
{ $$ = make_str("nocreateuser"); } { $$ = make_str("nocreateuser"); }
| IN GROUP user_list | IN_P GROUP_P user_list
{ $$ = cat2_str(make_str("in group"), $3); } { $$ = cat2_str(make_str("in group"), $3); }
| VALID UNTIL Sconst | VALID UNTIL Sconst
{ $$ = cat2_str(make_str("valid until"), $3); } { $$ = 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); } { $$ = 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); } { $$ = 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); } { $$ = 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); } { $$ = 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); } { $$ = cat2_str(make_str("drop group"), $3); }
; ;
@ -1234,7 +1234,7 @@ key_actions: key_delete { $$ = $1; }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
key_delete: ON DELETE key_reference key_delete: ON DELETE_P key_reference
{ $$ = cat2_str(make_str("on delete"), $3); } { $$ = cat2_str(make_str("on delete"), $3); }
; ;
@ -1396,7 +1396,7 @@ TriggerEvents: TriggerOneEvent
; ;
TriggerOneEvent: INSERT { $$ = make_str("insert"); } TriggerOneEvent: INSERT { $$ = make_str("insert"); }
| DELETE { $$ = make_str("delete"); } | DELETE_P { $$ = make_str("delete"); }
| UPDATE { $$ = make_str("update"); } | UPDATE { $$ = make_str("update"); }
; ;
@ -1611,7 +1611,7 @@ fetch_how_many: IntConst { $$ = $1; }
| PRIOR { $$ = make_str("prior"); } | PRIOR { $$ = make_str("prior"); }
; ;
from_in: IN { $$ = make_str("in"); } from_in: IN_P { $$ = make_str("in"); }
| FROM { $$ = make_str("from"); } | FROM { $$ = make_str("from"); }
; ;
@ -1687,7 +1687,7 @@ privilege_list: privilege
privilege: SELECT { $$ = make_str("select"); } privilege: SELECT { $$ = make_str("select"); }
| INSERT { $$ = make_str("insert"); } | INSERT { $$ = make_str("insert"); }
| UPDATE { $$ = make_str("update"); } | UPDATE { $$ = make_str("update"); }
| DELETE { $$ = make_str("delete"); } | DELETE_P { $$ = make_str("delete"); }
| RULE { $$ = make_str("rule"); } | RULE { $$ = make_str("rule"); }
| REFERENCES { $$ = make_str("references"); } | REFERENCES { $$ = make_str("references"); }
| TRIGGER { $$ = make_str("trigger"); } | TRIGGER { $$ = make_str("trigger"); }
@ -1719,7 +1719,7 @@ grantee_list: grantee
; ;
grantee: ColId { $$ = $1; } 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 opt_grant_grant_option: WITH GRANT OPTION
@ -1854,8 +1854,8 @@ func_arg: opt_arg func_type
| func_type { $$ = $1; } | func_type { $$ = $1; }
; ;
opt_arg: IN { $$ = make_str("in"); } opt_arg: IN_P { $$ = make_str("in"); }
| OUT | OUT_P
{ {
mmerror(PARSE_ERROR, ET_WARNING, "Currently unsupported CREATE FUNCTION/OUT will be passed to backend"); 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 */ /* change me to select, update, etc. some day */
event: SELECT { $$ = make_str("select"); } event: SELECT { $$ = make_str("select"); }
| UPDATE { $$ = make_str("update"); } | UPDATE { $$ = make_str("update"); }
| DELETE { $$ = make_str("delete"); } | DELETE_P { $$ = make_str("delete"); }
| INSERT { $$ = make_str("insert"); } | 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); } { $$ = 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); } { $$ = 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")); } { $$ = cat_str(3, make_str("in"), $2, make_str("mode")); }
| /*EMPTY*/ | /*EMPTY*/
{ $$ = EMPTY;} { $$ = EMPTY;}
@ -2600,7 +2600,7 @@ select_offset_value: PosIntConst
* ...however, recursive addattr and rename supported. make special * ...however, recursive addattr and rename supported. make special
* cases for these. * cases for these.
*/ */
group_clause: GROUP BY expr_list group_clause: GROUP_P BY expr_list
{ $$ = cat2_str(make_str("group by"), $3); } { $$ = cat2_str(make_str("group by"), $3); }
| /*EMPTY*/ | /*EMPTY*/
{ $$ = EMPTY; } { $$ = EMPTY; }
@ -2837,7 +2837,7 @@ Numeric: INT
{ $$ = make_str("bigint"); } { $$ = make_str("bigint"); }
| REAL | REAL
{ $$ = make_str("real"); } { $$ = make_str("real"); }
| FLOAT opt_float | FLOAT_P opt_float
{ $$ = cat2_str(make_str("float"), $2); } { $$ = cat2_str(make_str("float"), $2); }
| DOUBLE PRECISION | DOUBLE PRECISION
{ $$ = make_str("double precision"); } { $$ = make_str("double precision"); }
@ -2896,13 +2896,13 @@ Character: character '(' PosIntConst ')' opt_charset
character: CHARACTER opt_varying character: CHARACTER opt_varying
{ $$ = cat2_str(make_str("character"), $2); } { $$ = cat2_str(make_str("character"), $2); }
| CHAR opt_varying | CHAR_P opt_varying
{ $$ = cat2_str(make_str("char"), $2); } { $$ = cat2_str(make_str("char"), $2); }
| VARCHAR | VARCHAR
{ $$ = make_str("varchar"); } { $$ = make_str("varchar"); }
| NATIONAL CHARACTER opt_varying | NATIONAL CHARACTER opt_varying
{ $$ = cat2_str(make_str("national character"), $3); } { $$ = cat2_str(make_str("national character"), $3); }
| NATIONAL CHAR opt_varying | NATIONAL CHAR_P opt_varying
{ $$ = cat2_str(make_str("national char"), $3); } { $$ = cat2_str(make_str("national char"), $3); }
| NCHAR opt_varying | NCHAR opt_varying
{ $$ = cat2_str(make_str("nchar"), $2); } { $$ = 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 * Define row_descriptor to allow yacc to break the reduce/reduce conflict
* with singleton expressions. * 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); } { $$ = 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); } { $$ = cat_str(4, make_str("("), $2, make_str(") not in "), $6); }
| '(' row_descriptor ')' all_Op sub_type select_with_parens | '(' row_descriptor ')' all_Op sub_type select_with_parens
{ $$ = cat_str(6, make_str("("), $2, make_str(")"), $4, $5, $6); } { $$ = 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); } { $$ = cat_str(5, $1, make_str("between"), $3, make_str("and"), $5); }
| a_expr NOT BETWEEN b_expr AND b_expr %prec BETWEEN | a_expr NOT BETWEEN b_expr AND b_expr %prec BETWEEN
{ $$ = cat_str(5, $1, make_str("not between"), $4, make_str("and"), $6); } { $$ = 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); } { $$ = 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); } { $$ = cat_str(3, $1, make_str(" not in "), $4); }
| a_expr all_Op sub_type select_with_parens %prec Op | a_expr all_Op sub_type select_with_parens %prec Op
{ $$ = cat_str(4, $1, $2, $3, $4); } { $$ = 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 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); } { $$ = cat_str(3, $1, make_str("in"), $3); }
| /* EMPTY */ | /* EMPTY */
{ $$ = EMPTY; } { $$ = EMPTY; }
@ -4146,7 +4146,7 @@ unsigned_type: SQL_UNSIGNED SQL_SHORT { $$ = ECPGt_unsigned_short; }
$$ = ECPGt_unsigned_long; $$ = ECPGt_unsigned_long;
#endif #endif
} }
| SQL_UNSIGNED CHAR { $$ = ECPGt_unsigned_char; } | SQL_UNSIGNED CHAR_P { $$ = ECPGt_unsigned_char; }
; ;
signed_type: SQL_SHORT { $$ = ECPGt_short; } signed_type: SQL_SHORT { $$ = ECPGt_short; }
@ -4171,7 +4171,7 @@ signed_type: SQL_SHORT { $$ = ECPGt_short; }
#endif #endif
} }
| SQL_BOOL { $$ = ECPGt_bool; } | SQL_BOOL { $$ = ECPGt_bool; }
| CHAR { $$ = ECPGt_char; } | CHAR_P { $$ = ECPGt_char; }
; ;
opt_signed: SQL_SIGNED opt_signed: SQL_SIGNED
@ -4823,7 +4823,7 @@ ColId: ident { $$ = $1; }
| unreserved_keyword { $$ = $1; } | unreserved_keyword { $$ = $1; }
| col_name_keyword { $$ = $1; } | col_name_keyword { $$ = $1; }
| ECPGKeywords { $$ = $1; } | ECPGKeywords { $$ = $1; }
| CHAR { $$ = make_str("char"); } | CHAR_P { $$ = make_str("char"); }
; ;
/* Type identifier --- names that can be type names. /* Type identifier --- names that can be type names.
@ -4847,7 +4847,7 @@ function_name: ident { $$ = $1; }
*/ */
ColLabel: ECPGColLabel { $$ = $1; } ColLabel: ECPGColLabel { $$ = $1; }
| ECPGTypeName { $$ = $1; } | ECPGTypeName { $$ = $1; }
| CHAR { $$ = make_str("char"); } | CHAR_P { $$ = make_str("char"); }
| INT { $$ = make_str("int"); } | INT { $$ = make_str("int"); }
| UNION { $$ = make_str("union"); } | UNION { $$ = make_str("union"); }
; ;
@ -4907,7 +4907,7 @@ unreserved_keyword:
| DAY_P { $$ = make_str("day"); } | DAY_P { $$ = make_str("day"); }
| DECLARE { $$ = make_str("declare"); } | DECLARE { $$ = make_str("declare"); }
| DEFERRED { $$ = make_str("deferred"); } | DEFERRED { $$ = make_str("deferred"); }
| DELETE { $$ = make_str("delete"); } | DELETE_P { $$ = make_str("delete"); }
| DELIMITERS { $$ = make_str("delimiters"); } | DELIMITERS { $$ = make_str("delimiters"); }
| DOMAIN_P { $$ = make_str("domain"); } | DOMAIN_P { $$ = make_str("domain"); }
| DOUBLE { $$ = make_str("double"); } | DOUBLE { $$ = make_str("double"); }
@ -4963,7 +4963,7 @@ unreserved_keyword:
| OIDS { $$ = make_str("oids"); } | OIDS { $$ = make_str("oids"); }
| OPERATOR { $$ = make_str("operator"); } | OPERATOR { $$ = make_str("operator"); }
| OPTION { $$ = make_str("option"); } | OPTION { $$ = make_str("option"); }
| OUT { $$ = make_str("out"); } | OUT_P { $$ = make_str("out"); }
| OWNER { $$ = make_str("owner"); } | OWNER { $$ = make_str("owner"); }
| PARTIAL { $$ = make_str("partial"); } | PARTIAL { $$ = make_str("partial"); }
| PASSWORD { $$ = make_str("password"); } | PASSWORD { $$ = make_str("password"); }
@ -5044,7 +5044,7 @@ col_name_keyword:
BIGINT { $$ = make_str("bigint");} BIGINT { $$ = make_str("bigint");}
| BIT { $$ = make_str("bit"); } | BIT { $$ = make_str("bit"); }
/* CHAR must be excluded from ECPGColLabel because of conflict with UNSIGNED /* CHAR must be excluded from ECPGColLabel because of conflict with UNSIGNED
| CHAR { $$ = make_str("char"); } | CHAR_P { $$ = make_str("char"); }
*/ */
| CHARACTER { $$ = make_str("character"); } | CHARACTER { $$ = make_str("character"); }
| COALESCE { $$ = make_str("coalesce"); } | COALESCE { $$ = make_str("coalesce"); }
@ -5052,7 +5052,7 @@ col_name_keyword:
| DECIMAL { $$ = make_str("decimal"); } | DECIMAL { $$ = make_str("decimal"); }
| EXISTS { $$ = make_str("exists"); } | EXISTS { $$ = make_str("exists"); }
| EXTRACT { $$ = make_str("extract"); } | EXTRACT { $$ = make_str("extract"); }
| FLOAT { $$ = make_str("float"); } | FLOAT_P { $$ = make_str("float"); }
/* INT must be excluded from ECPGColLabel because of conflict /* INT must be excluded from ECPGColLabel because of conflict
| INT { $$ = make_str("int"); } | INT { $$ = make_str("int"); }
*/ */
@ -5091,7 +5091,7 @@ func_name_keyword:
| FREEZE { $$ = make_str("freeze"); } | FREEZE { $$ = make_str("freeze"); }
| FULL { $$ = make_str("full"); } | FULL { $$ = make_str("full"); }
| ILIKE { $$ = make_str("ilike"); } | ILIKE { $$ = make_str("ilike"); }
| IN { $$ = make_str("in"); } | IN_P { $$ = make_str("in"); }
| INNER_P { $$ = make_str("inner"); } | INNER_P { $$ = make_str("inner"); }
| IS { $$ = make_str("is"); } | IS { $$ = make_str("is"); }
| ISNULL { $$ = make_str("isnull"); } | ISNULL { $$ = make_str("isnull"); }
@ -5145,7 +5145,7 @@ reserved_keyword:
| FOREIGN { $$ = make_str("foreign"); } | FOREIGN { $$ = make_str("foreign"); }
| FROM { $$ = make_str("from"); } | FROM { $$ = make_str("from"); }
| GRANT { $$ = make_str("grant"); } | GRANT { $$ = make_str("grant"); }
| GROUP { $$ = make_str("group"); } | GROUP_P { $$ = make_str("group"); }
| HAVING { $$ = make_str("having"); } | HAVING { $$ = make_str("having"); }
| INITIALLY { $$ = make_str("initially"); } | INITIALLY { $$ = make_str("initially"); }
| INTERSECT { $$ = make_str("intersect"); } | INTERSECT { $$ = make_str("intersect"); }
@ -5305,9 +5305,9 @@ c_anything: IDENT { $$ = $1; }
| SQL_SIGNED { $$ = make_str("signed"); } | SQL_SIGNED { $$ = make_str("signed"); }
| SQL_STRUCT { $$ = make_str("struct"); } | SQL_STRUCT { $$ = make_str("struct"); }
| SQL_UNSIGNED { $$ = make_str("unsigned"); } | SQL_UNSIGNED { $$ = make_str("unsigned"); }
| CHAR { $$ = make_str("char"); } | CHAR_P { $$ = make_str("char"); }
| DOUBLE { $$ = make_str("double"); } | DOUBLE { $$ = make_str("double"); }
| FLOAT { $$ = make_str("float"); } | FLOAT_P { $$ = make_str("float"); }
| UNION { $$ = make_str("union"); } | UNION { $$ = make_str("union"); }
| VARCHAR { $$ = make_str("varchar"); } | VARCHAR { $$ = make_str("varchar"); }
| '[' { $$ = make_str("["); } | '[' { $$ = make_str("["); }

View File

@ -10,7 +10,7 @@
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes). * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
* *
* IDENTIFICATION * 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]; char username[128];
DWORD namesize = sizeof(username) - 1; DWORD namesize = sizeof(username) - 1;
if (GetUserName(username, &namesize)) if (GetUserNameFromId(username, &namesize))
name = username; name = username;
#else #else
struct passwd *pw = getpwuid(geteuid()); struct passwd *pw = getpwuid(geteuid());