Superficial changes for Win32 - Mailing list pgsql-patches

From Katherine Ward
Subject Superficial changes for Win32
Date
Msg-id 20020610175632.79278.qmail@web11104.mail.yahoo.com
Whole thread Raw
Responses Re: Superficial changes for Win32  (Jan Wieck <janwieck@yahoo.com>)
List pgsql-patches
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/datetime.c

2.  Added _P to some lex/yacc tokens:
    CONST, CHAR, DELETE, FLOAT, GROUP, IN, OUT


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.comIndex: src/backend/access/transam/transam.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/transam.c,v
retrieving revision 1.51
diff -c -r1.51 transam.c
*** src/backend/access/transam/transam.c    2002/05/25 20:00:11    1.51
--- src/backend/access/transam/transam.c    2002/06/10 17:44:24
***************
*** 201,207 ****

  /*
   * Now this func in shmem.c and gives quality answer by scanning
!  * PROC structures of all running backend. - vadim 11/26/96
   *
   * Old comments:
   * true if given transaction has neither committed nor aborted
--- 201,207 ----

  /*
   * Now this func in shmem.c and gives quality answer by scanning
!  * PGPROC structures of all running backend. - vadim 11/26/96
   *
   * Old comments:
   * true if given transaction has neither committed nor aborted
Index: src/backend/access/transam/varsup.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/varsup.c,v
retrieving revision 1.49
diff -c -r1.49 varsup.c
*** src/backend/access/transam/varsup.c    2002/05/25 20:00:11    1.49
--- src/backend/access/transam/varsup.c    2002/06/10 17:44:24
***************
*** 61,83 ****
       * Must set MyProc->xid before releasing XidGenLock.  This ensures
       * that when GetSnapshotData calls ReadNewTransactionId, all active
       * XIDs before the returned value of nextXid are already present in
!      * the shared PROC array.  Else we have a race condition.
       *
       * XXX by storing xid into MyProc without acquiring SInvalLock, we are
       * relying on fetch/store of an xid to be atomic, else other backends
       * might see a partially-set xid here.    But holding both locks at once
       * would be a nasty concurrency hit (and in fact could cause a
       * deadlock against GetSnapshotData).  So for now, assume atomicity.
!      * Note that readers of PROC xid field should be careful to fetch the
       * value only once, rather than assume they can read it multiple times
       * and get the same answer each time.
       *
!      * A solution to the atomic-store problem would be to give each PROC its
!      * own spinlock used only for fetching/storing that PROC's xid.
       * (SInvalLock would then mean primarily that PROCs couldn't be added/
       * removed while holding the lock.)
       */
!     if (MyProc != (PROC *) NULL)
          MyProc->xid = xid;

      LWLockRelease(XidGenLock);
--- 61,83 ----
       * Must set MyProc->xid before releasing XidGenLock.  This ensures
       * that when GetSnapshotData calls ReadNewTransactionId, all active
       * XIDs before the returned value of nextXid are already present in
!      * the shared PGPROC array.  Else we have a race condition.
       *
       * XXX by storing xid into MyProc without acquiring SInvalLock, we are
       * relying on fetch/store of an xid to be atomic, else other backends
       * might see a partially-set xid here.    But holding both locks at once
       * would be a nasty concurrency hit (and in fact could cause a
       * deadlock against GetSnapshotData).  So for now, assume atomicity.
!      * Note that readers of PGPROC xid field should be careful to fetch the
       * value only once, rather than assume they can read it multiple times
       * and get the same answer each time.
       *
!      * A solution to the atomic-store problem would be to give each PGPROC its
!      * own spinlock used only for fetching/storing that PGPROC's xid.
       * (SInvalLock would then mean primarily that PROCs couldn't be added/
       * removed while holding the lock.)
       */
!     if (MyProc != (PGPROC *) NULL)
          MyProc->xid = xid;

      LWLockRelease(XidGenLock);
Index: src/backend/access/transam/xact.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xact.c,v
retrieving revision 1.125
diff -c -r1.125 xact.c
*** src/backend/access/transam/xact.c    2002/05/25 20:00:12    1.125
--- src/backend/access/transam/xact.c    2002/06/10 17:44:26
***************
*** 602,608 ****
      MyLastRecPtr.xrecoff = 0;
      MyXactMadeXLogEntry = false;

!     /* Show myself as out of the transaction in PROC array */
      MyProc->logRec.xrecoff = 0;

      if (leak)
--- 602,608 ----
      MyLastRecPtr.xrecoff = 0;
      MyXactMadeXLogEntry = false;

!     /* Show myself as out of the transaction in PGPROC array */
      MyProc->logRec.xrecoff = 0;

      if (leak)
***************
*** 727,733 ****
      MyLastRecPtr.xrecoff = 0;
      MyXactMadeXLogEntry = false;

!     /* Show myself as out of the transaction in PROC array */
      MyProc->logRec.xrecoff = 0;

      /*
--- 727,733 ----
      MyLastRecPtr.xrecoff = 0;
      MyXactMadeXLogEntry = false;

!     /* Show myself as out of the transaction in PGPROC array */
      MyProc->logRec.xrecoff = 0;

      /*
***************
*** 960,966 ****
       * as running as well or it will see two tuple versions - one deleted
       * by xid 1 and one inserted by xid 0.    See notes in GetSnapshotData.
       */
!     if (MyProc != (PROC *) NULL)
      {
          /* Lock SInvalLock because that's what GetSnapshotData uses. */
          LWLockAcquire(SInvalLock, LW_EXCLUSIVE);
--- 960,966 ----
       * as running as well or it will see two tuple versions - one deleted
       * by xid 1 and one inserted by xid 0.    See notes in GetSnapshotData.
       */
!     if (MyProc != (PGPROC *) NULL)
      {
          /* Lock SInvalLock because that's what GetSnapshotData uses. */
          LWLockAcquire(SInvalLock, LW_EXCLUSIVE);
***************
*** 1069,1075 ****
       * this must be done _before_ releasing locks we hold and _after_
       * RecordTransactionAbort.
       */
!     if (MyProc != (PROC *) NULL)
      {
          /* Lock SInvalLock because that's what GetSnapshotData uses. */
          LWLockAcquire(SInvalLock, LW_EXCLUSIVE);
--- 1069,1075 ----
       * this must be done _before_ releasing locks we hold and _after_
       * RecordTransactionAbort.
       */
!     if (MyProc != (PGPROC *) NULL)
      {
          /* Lock SInvalLock because that's what GetSnapshotData uses. */
          LWLockAcquire(SInvalLock, LW_EXCLUSIVE);
Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.96
diff -c -r1.96 xlog.c
*** src/backend/access/transam/xlog.c    2002/06/07 21:47:45    1.96
--- src/backend/access/transam/xlog.c    2002/06/10 17:44:27
***************
*** 753,759 ****
      /* Compute record's XLOG location */
      INSERT_RECPTR(RecPtr, Insert, curridx);

!     /* If first XLOG record of transaction, save it in PROC array */
      if (MyLastRecPtr.xrecoff == 0 && !no_tran)
      {
          /*
--- 753,759 ----
      /* Compute record's XLOG location */
      INSERT_RECPTR(RecPtr, Insert, curridx);

!     /* If first XLOG record of transaction, save it in PGPROC array */
      if (MyLastRecPtr.xrecoff == 0 && !no_tran)
      {
          /*
***************
*** 3026,3032 ****
      }

      /*
!      * Get UNDO record ptr - this is oldest of PROC->logRec values. We do
       * this while holding insert lock to ensure that we won't miss any
       * about-to-commit transactions (UNDO must include all xacts that have
       * commits after REDO point).
--- 3026,3032 ----
      }

      /*
!      * Get UNDO record ptr - this is oldest of PGPROC->logRec values. We do
       * this while holding insert lock to ensure that we won't miss any
       * about-to-commit transactions (UNDO must include all xacts that have
       * commits after REDO point).
Index: src/backend/bootstrap/bootparse.y
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v
retrieving revision 1.46
diff -c -r1.46 bootparse.y
*** src/backend/bootstrap/bootparse.y    2002/04/27 21:24:33    1.46
--- src/backend/bootstrap/bootparse.y    2002/06/10 17:44:27
***************
*** 93,99 ****
  %type <ival>  boot_tuple boot_tuplelist
  %type <oidval> optoideq

! %token <ival> CONST ID
  %token OPEN XCLOSE XCREATE INSERT_TUPLE
  %token STRING XDEFINE
  %token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE
--- 93,99 ----
  %type <ival>  boot_tuple boot_tuplelist
  %type <oidval> optoideq

! %token <ival> CONST_P ID
  %token OPEN XCLOSE XCREATE INSERT_TUPLE
  %token STRING XDEFINE
  %token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE
***************
*** 329,335 ****
          ;

  boot_const :
!           CONST { $$=yylval.ival; }
          ;

  boot_ident :
--- 329,335 ----
          ;

  boot_const :
!           CONST_P { $$=yylval.ival; }
          ;

  boot_ident :
Index: src/backend/bootstrap/bootscanner.l
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v
retrieving revision 1.22
diff -c -r1.22 bootscanner.l
*** src/backend/bootstrap/bootscanner.l    2002/04/27 21:24:33    1.22
--- src/backend/bootstrap/bootscanner.l    2002/06/10 17:44:27
***************
*** 121,127 ****
  (-)?{D}*"."{D}+({Exp})? |
  (-)?{D}+{Exp}            {
                              yylval.ival = EnterString((char*)yytext);
!                             return(CONST);
                          }

  .                {
--- 121,127 ----
  (-)?{D}*"."{D}+({Exp})? |
  (-)?{D}+{Exp}            {
                              yylval.ival = EnterString((char*)yytext);
!                             return(CONST_P);
                          }

  .                {
Index: src/backend/commands/schemacmds.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/schemacmds.c,v
retrieving revision 1.3
diff -c -r1.3 schemacmds.c
*** src/backend/commands/schemacmds.c    2002/05/17 20:53:33    1.3
--- src/backend/commands/schemacmds.c    2002/06/10 17:44:27
***************
*** 50,56 ****
      if (!authId)
      {
          owner_userid = saved_userid;
!         owner_name = GetUserName(owner_userid);
      }
      else if (superuser())
      {
--- 50,56 ----
      if (!authId)
      {
          owner_userid = saved_userid;
!         owner_name = GetUserNameFromId(owner_userid);
      }
      else if (superuser())
      {
***************
*** 68,74 ****
      else /* not superuser */
      {
          owner_userid = saved_userid;
!         owner_name = GetUserName(owner_userid);
          if (strcmp(authId, owner_name) != 0)
              elog(ERROR, "CREATE SCHEMA: permission denied"
                   "\n\t\"%s\" is not a superuser, so cannot create a schema for \"%s\"",
--- 68,74 ----
      else /* not superuser */
      {
          owner_userid = saved_userid;
!         owner_name = GetUserNameFromId(owner_userid);
          if (strcmp(authId, owner_name) != 0)
              elog(ERROR, "CREATE SCHEMA: permission denied"
                   "\n\t\"%s\" is not a superuser, so cannot create a schema for \"%s\"",
Index: src/backend/commands/user.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/user.c,v
retrieving revision 1.103
diff -c -r1.103 user.c
*** src/backend/commands/user.c    2002/05/21 22:05:54    1.103
--- src/backend/commands/user.c    2002/06/10 17:44:27
***************
*** 724,730 ****
            createuser < 0 &&
            !validUntil &&
            password &&
!           strcmp(GetUserName(GetUserId()), stmt->user) == 0))
          elog(ERROR, "ALTER USER: permission denied");

      /* changes to the flat password file cannot be rolled back */
--- 724,730 ----
            createuser < 0 &&
            !validUntil &&
            password &&
!           strcmp(GetUserNameFromId(GetUserId()), stmt->user) == 0))
          elog(ERROR, "ALTER USER: permission denied");

      /* changes to the flat password file cannot be rolled back */
Index: src/backend/commands/variable.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/variable.c,v
retrieving revision 1.67
diff -c -r1.67 variable.c
*** src/backend/commands/variable.c    2002/05/17 01:19:17    1.67
--- src/backend/commands/variable.c    2002/06/10 17:44:27
***************
*** 583,587 ****
  const char *
  show_session_authorization(void)
  {
!     return GetUserName(GetSessionUserId());
  }
--- 583,587 ----
  const char *
  show_session_authorization(void)
  {
!     return GetUserNameFromId(GetSessionUserId());
  }
Index: src/backend/parser/gram.y
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.319
diff -c -r2.319 gram.y
*** src/backend/parser/gram.y    2002/05/22 17:20:59    2.319
--- src/backend/parser/gram.y    2002/06/10 17:44:28
***************
*** 321,345 ****
      BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
      BOOLEAN, BY,

!     CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR, CHARACTER,
      CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE,
      COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY,
      CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME,
      CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,

      DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED,
!     DEFINER, DELETE, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP,

      EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE,
      EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT,

!     FALSE_P, FETCH, FLOAT, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM,
      FULL, FUNCTION,

!     GLOBAL, GRANT, GROUP,
      HANDLER, HAVING, HOUR_P,

!     ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN, INCREMENT, INDEX, INHERITS,
      INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT,
      INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION,

--- 321,345 ----
      BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
      BOOLEAN, BY,

!     CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR_P, CHARACTER,
      CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE,
      COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY,
      CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME,
      CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,

      DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED,
!     DEFINER, DELETE_P, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP,

      EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE,
      EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT,

!     FALSE_P, FETCH, FLOAT_P, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM,
      FULL, FUNCTION,

!     GLOBAL, GRANT, GROUP_P,
      HANDLER, HAVING, HOUR_P,

!     ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN_P, INCREMENT, INDEX, INHERITS,
      INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT,
      INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION,

***************
*** 356,362 ****
      NUMERIC,

      OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER,
!     OUT, OUTER_P, OVERLAPS, OWNER,

      PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY,
      PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL,
--- 356,362 ----
      NUMERIC,

      OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER,
!     OUT_P, OUTER_P, OVERLAPS, OWNER,

      PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY,
      PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL,
***************
*** 406,412 ****
  %nonassoc    ESCAPE
  %nonassoc    OVERLAPS
  %nonassoc    BETWEEN
! %nonassoc    IN
  %left        POSTFIXOP        /* dummy for postfix Op rules */
  %left        Op OPERATOR        /* multi-character ops and user-defined operators */
  %nonassoc    NOTNULL
--- 406,412 ----
  %nonassoc    ESCAPE
  %nonassoc    OVERLAPS
  %nonassoc    BETWEEN
! %nonassoc    IN_P
  %left        POSTFIXOP        /* dummy for postfix Op rules */
  %left        Op OPERATOR        /* multi-character ops and user-defined operators */
  %nonassoc    NOTNULL
***************
*** 647,653 ****
                      $$->defname = "createuser";
                      $$->arg = (Node *)makeInteger(FALSE);
                  }
!             | IN GROUP user_list
                  {
                      $$ = makeNode(DefElem);
                      $$->defname = "groupElts";
--- 647,653 ----
                      $$->defname = "createuser";
                      $$->arg = (Node *)makeInteger(FALSE);
                  }
!             | IN_P GROUP_P user_list
                  {
                      $$ = makeNode(DefElem);
                      $$->defname = "groupElts";
***************
*** 680,693 ****
   *
   *****************************************************************************/

! CreateGroupStmt:  CREATE GROUP UserId OptGroupList
                  {
                      CreateGroupStmt *n = makeNode(CreateGroupStmt);
                      n->name = $3;
                      n->options = $4;
                      $$ = (Node *)n;
                  }
!             | CREATE GROUP UserId WITH OptGroupList
                  {
                      CreateGroupStmt *n = makeNode(CreateGroupStmt);
                      n->name = $3;
--- 680,693 ----
   *
   *****************************************************************************/

! CreateGroupStmt:  CREATE GROUP_P UserId OptGroupList
                  {
                      CreateGroupStmt *n = makeNode(CreateGroupStmt);
                      n->name = $3;
                      n->options = $4;
                      $$ = (Node *)n;
                  }
!             | CREATE GROUP_P UserId WITH OptGroupList
                  {
                      CreateGroupStmt *n = makeNode(CreateGroupStmt);
                      n->name = $3;
***************
*** 725,731 ****
   *
   *****************************************************************************/

! AlterGroupStmt:  ALTER GROUP UserId ADD USER user_list
                  {
                      AlterGroupStmt *n = makeNode(AlterGroupStmt);
                      n->name = $3;
--- 725,731 ----
   *
   *****************************************************************************/

! AlterGroupStmt:  ALTER GROUP_P UserId ADD USER user_list
                  {
                      AlterGroupStmt *n = makeNode(AlterGroupStmt);
                      n->name = $3;
***************
*** 733,739 ****
                      n->listUsers = $6;
                      $$ = (Node *)n;
                  }
!             | ALTER GROUP UserId DROP USER user_list
                  {
                      AlterGroupStmt *n = makeNode(AlterGroupStmt);
                      n->name = $3;
--- 733,739 ----
                      n->listUsers = $6;
                      $$ = (Node *)n;
                  }
!             | ALTER GROUP_P UserId DROP USER user_list
                  {
                      AlterGroupStmt *n = makeNode(AlterGroupStmt);
                      n->name = $3;
***************
*** 751,757 ****
   *
   *****************************************************************************/

! DropGroupStmt: DROP GROUP UserId
                  {
                      DropGroupStmt *n = makeNode(DropGroupStmt);
                      n->name = $3;
--- 751,757 ----
   *
   *****************************************************************************/

! DropGroupStmt: DROP GROUP_P UserId
                  {
                      DropGroupStmt *n = makeNode(DropGroupStmt);
                      n->name = $3;
***************
*** 1671,1677 ****
          | /*EMPTY*/                        { $$ = 0; }
          ;

! key_delete:  ON DELETE key_reference    { $$ = $3 << FKCONSTR_ON_DELETE_SHIFT; }
          ;

  key_update:  ON UPDATE key_reference    { $$ = $3 << FKCONSTR_ON_UPDATE_SHIFT; }
--- 1671,1677 ----
          | /*EMPTY*/                        { $$ = 0; }
          ;

! key_delete:  ON DELETE_P key_reference    { $$ = $3 << FKCONSTR_ON_DELETE_SHIFT; }
          ;

  key_update:  ON UPDATE key_reference    { $$ = $3 << FKCONSTR_ON_UPDATE_SHIFT; }
***************
*** 1963,1969 ****
          ;

  TriggerOneEvent:  INSERT                    { $$ = 'i'; }
!             | DELETE                        { $$ = 'd'; }
              | UPDATE                        { $$ = 'u'; }
          ;

--- 1963,1969 ----
          ;

  TriggerOneEvent:  INSERT                    { $$ = 'i'; }
!             | DELETE_P                        { $$ = 'd'; }
              | UPDATE                        { $$ = 'u'; }
          ;

***************
*** 2472,2478 ****
          | PRIOR                            { $$ = -1; }
          ;

! from_in:  IN                            { }
      | FROM                                { }
      ;

--- 2472,2478 ----
          | PRIOR                            { $$ = -1; }
          ;

! from_in:  IN_P                            { }
      | FROM                                { }
      ;

***************
*** 2524,2530 ****
  privilege: SELECT    { $$ = ACL_SELECT; }
          | INSERT     { $$ = ACL_INSERT; }
          | UPDATE     { $$ = ACL_UPDATE; }
!         | DELETE     { $$ = ACL_DELETE; }
          | RULE       { $$ = ACL_RULE; }
          | REFERENCES { $$ = ACL_REFERENCES; }
          | TRIGGER    { $$ = ACL_TRIGGER; }
--- 2524,2530 ----
  privilege: SELECT    { $$ = ACL_SELECT; }
          | INSERT     { $$ = ACL_INSERT; }
          | UPDATE     { $$ = ACL_UPDATE; }
!         | DELETE_P   { $$ = ACL_DELETE; }
          | RULE       { $$ = ACL_RULE; }
          | REFERENCES { $$ = ACL_REFERENCES; }
          | TRIGGER    { $$ = ACL_TRIGGER; }
***************
*** 2598,2604 ****
                      n->groupname = NULL;
                      $$ = (Node *)n;
                  }
!         | GROUP ColId
                  {
                      PrivGrantee *n = makeNode(PrivGrantee);
                      /* Treat GROUP PUBLIC as a synonym for PUBLIC */
--- 2598,2604 ----
                      n->groupname = NULL;
                      $$ = (Node *)n;
                  }
!         | GROUP_P ColId
                  {
                      PrivGrantee *n = makeNode(PrivGrantee);
                      /* Treat GROUP PUBLIC as a synonym for PUBLIC */
***************
*** 2807,2817 ****
                  }
          ;

! opt_arg:  IN
                  {
                      $$ = FALSE;
                  }
!         | OUT
                  {
                      elog(ERROR, "CREATE FUNCTION / OUT parameters are not supported");
                      $$ = TRUE;
--- 2807,2817 ----
                  }
          ;

! opt_arg:  IN_P
                  {
                      $$ = FALSE;
                  }
!         | OUT_P
                  {
                      elog(ERROR, "CREATE FUNCTION / OUT parameters are not supported");
                      $$ = TRUE;
***************
*** 3143,3149 ****
  /* change me to select, update, etc. some day */
  event:    SELECT                            { $$ = CMD_SELECT; }
          | UPDATE                        { $$ = CMD_UPDATE; }
!         | DELETE                        { $$ = CMD_DELETE; }
          | INSERT                        { $$ = CMD_INSERT; }
           ;

--- 3143,3149 ----
  /* change me to select, update, etc. some day */
  event:    SELECT                            { $$ = CMD_SELECT; }
          | UPDATE                        { $$ = CMD_UPDATE; }
!         | DELETE_P                        { $$ = CMD_DELETE; }
          | INSERT                        { $$ = CMD_INSERT; }
           ;

***************
*** 3728,3734 ****
   *
   *****************************************************************************/

! DeleteStmt:  DELETE FROM relation_expr where_clause
                  {
                      DeleteStmt *n = makeNode(DeleteStmt);
                      n->relation = $3;
--- 3728,3734 ----
   *
   *****************************************************************************/

! DeleteStmt:  DELETE_P FROM relation_expr where_clause
                  {
                      DeleteStmt *n = makeNode(DeleteStmt);
                      n->relation = $3;
***************
*** 3747,3753 ****
                  }
          ;

! opt_lock:  IN lock_type MODE    { $$ = $2; }
          | /*EMPTY*/                { $$ = AccessExclusiveLock; }
          ;

--- 3747,3753 ----
                  }
          ;

! opt_lock:  IN_P lock_type MODE    { $$ = $2; }
          | /*EMPTY*/                { $$ = AccessExclusiveLock; }
          ;

***************
*** 4134,4140 ****
   *    cases for these.
   */

! group_clause:  GROUP BY expr_list                { $$ = $3; }
          | /*EMPTY*/                                { $$ = NIL; }
          ;

--- 4134,4140 ----
   *    cases for these.
   */

! group_clause:  GROUP_P BY expr_list                { $$ = $3; }
          | /*EMPTY*/                                { $$ = NIL; }
          ;

***************
*** 4535,4541 ****
                  {
                      $$ = SystemTypeName("float4");
                  }
!         | FLOAT opt_float
                  {
                      $$ = $2;
                  }
--- 4535,4541 ----
                  {
                      $$ = SystemTypeName("float4");
                  }
!         | FLOAT_P opt_float
                  {
                      $$ = $2;
                  }
***************
*** 4726,4735 ****
          ;

  character:  CHARACTER opt_varying                { $$ = $2 ? "varchar": "bpchar"; }
!         | CHAR opt_varying                        { $$ = $2 ? "varchar": "bpchar"; }
          | VARCHAR                                { $$ = "varchar"; }
          | NATIONAL CHARACTER opt_varying        { $$ = $3 ? "varchar": "bpchar"; }
!         | NATIONAL CHAR opt_varying                { $$ = $3 ? "varchar": "bpchar"; }
          | NCHAR opt_varying                        { $$ = $2 ? "varchar": "bpchar"; }
          ;

--- 4726,4735 ----
          ;

  character:  CHARACTER opt_varying                { $$ = $2 ? "varchar": "bpchar"; }
!         | CHAR_P opt_varying                        { $$ = $2 ? "varchar": "bpchar"; }
          | VARCHAR                                { $$ = "varchar"; }
          | NATIONAL CHARACTER opt_varying        { $$ = $3 ? "varchar": "bpchar"; }
!         | NATIONAL CHAR_P opt_varying                { $$ = $3 ? "varchar": "bpchar"; }
          | NCHAR opt_varying                        { $$ = $2 ? "varchar": "bpchar"; }
          ;

***************
*** 4842,4848 ****
   * Define row_descriptor to allow yacc to break the reduce/reduce conflict
   *  with singleton expressions.
   */
! row_expr: '(' row_descriptor ')' IN select_with_parens
                  {
                      SubLink *n = makeNode(SubLink);
                      n->lefthand = $2;
--- 4842,4848 ----
   * Define row_descriptor to allow yacc to break the reduce/reduce conflict
   *  with singleton expressions.
   */
! row_expr: '(' row_descriptor ')' IN_P select_with_parens
                  {
                      SubLink *n = makeNode(SubLink);
                      n->lefthand = $2;
***************
*** 4852,4858 ****
                      n->subselect = $5;
                      $$ = (Node *)n;
                  }
!         | '(' row_descriptor ')' NOT IN select_with_parens
                  {
                      SubLink *n = makeNode(SubLink);
                      n->lefthand = $2;
--- 4852,4858 ----
                      n->subselect = $5;
                      $$ = (Node *)n;
                  }
!         | '(' row_descriptor ')' NOT IN_P select_with_parens
                  {
                      SubLink *n = makeNode(SubLink);
                      n->lefthand = $2;
***************
*** 5190,5196 ****
                          (Node *) makeSimpleA_Expr(OP, "<", $1, $4),
                          (Node *) makeSimpleA_Expr(OP, ">", $1, $6));
                  }
!         | a_expr IN in_expr
                  {
                      /* in_expr returns a SubLink or a list of a_exprs */
                      if (IsA($3, SubLink))
--- 5190,5196 ----
                          (Node *) makeSimpleA_Expr(OP, "<", $1, $4),
                          (Node *) makeSimpleA_Expr(OP, ">", $1, $6));
                  }
!         | a_expr IN_P in_expr
                  {
                      /* in_expr returns a SubLink or a list of a_exprs */
                      if (IsA($3, SubLink))
***************
*** 5220,5226 ****
                          $$ = n;
                      }
                  }
!         | a_expr NOT IN in_expr
                  {
                      /* in_expr returns a SubLink or a list of a_exprs */
                      if (IsA($4, SubLink))
--- 5220,5226 ----
                          $$ = n;
                      }
                  }
!         | a_expr NOT IN_P in_expr
                  {
                      /* in_expr returns a SubLink or a list of a_exprs */
                      if (IsA($4, SubLink))
***************
*** 5708,5714 ****

  /* position_list uses b_expr not a_expr to avoid conflict with general IN */

! position_list:  b_expr IN b_expr
                  {    $$ = makeList2($3, $1); }
          | /*EMPTY*/
                  {    $$ = NIL; }
--- 5708,5714 ----

  /* position_list uses b_expr not a_expr to avoid conflict with general IN */

! position_list:  b_expr IN_P b_expr
                  {    $$ = makeList2($3, $1); }
          | /*EMPTY*/
                  {    $$ = NIL; }
***************
*** 6242,6248 ****
          | DECLARE
          | DEFERRED
          | DEFINER
!         | DELETE
          | DELIMITERS
          | DOMAIN_P
          | DOUBLE
--- 6242,6248 ----
          | DECLARE
          | DEFERRED
          | DEFINER
!         | DELETE_P
          | DELIMITERS
          | DOMAIN_P
          | DOUBLE
***************
*** 6303,6309 ****
          | OIDS
          | OPERATOR
          | OPTION
!         | OUT
          | OWNER
          | PARTIAL
          | PASSWORD
--- 6303,6309 ----
          | OIDS
          | OPERATOR
          | OPTION
!         | OUT_P
          | OWNER
          | PARTIAL
          | PASSWORD
***************
*** 6389,6402 ****
            BIGINT
          | BIT
          | BOOLEAN
!         | CHAR
          | CHARACTER
          | COALESCE
          | DEC
          | DECIMAL
          | EXISTS
          | EXTRACT
!         | FLOAT
          | INT
          | INTEGER
          | INTERVAL
--- 6389,6402 ----
            BIGINT
          | BIT
          | BOOLEAN
!         | CHAR_P
          | CHARACTER
          | COALESCE
          | DEC
          | DECIMAL
          | EXISTS
          | EXTRACT
!         | FLOAT_P
          | INT
          | INTEGER
          | INTERVAL
***************
*** 6433,6439 ****
          | FREEZE
          | FULL
          | ILIKE
!         | IN
          | INNER_P
          | IS
          | ISNULL
--- 6433,6439 ----
          | FREEZE
          | FULL
          | ILIKE
!         | IN_P
          | INNER_P
          | IS
          | ISNULL
***************
*** 6487,6493 ****
          | FOREIGN
          | FROM
          | GRANT
!         | GROUP
          | HAVING
          | INITIALLY
          | INTERSECT
--- 6487,6493 ----
          | FOREIGN
          | FROM
          | GRANT
!         | GROUP_P
          | HAVING
          | INITIALLY
          | INTERSECT
Index: src/backend/parser/keywords.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/parser/keywords.c,v
retrieving revision 1.111
diff -c -r1.111 keywords.c
*** src/backend/parser/keywords.c    2002/05/22 17:20:59    1.111
--- src/backend/parser/keywords.c    2002/06/10 17:44:28
***************
*** 62,68 ****
      {"case", CASE},
      {"cast", CAST},
      {"chain", CHAIN},
!     {"char", CHAR},
      {"character", CHARACTER},
      {"characteristics", CHARACTERISTICS},
      {"check", CHECK},
--- 62,68 ----
      {"case", CASE},
      {"cast", CAST},
      {"chain", CHAIN},
!     {"char", CHAR_P},
      {"character", CHARACTER},
      {"characteristics", CHARACTERISTICS},
      {"check", CHECK},
***************
*** 97,103 ****
      {"deferrable", DEFERRABLE},
      {"deferred", DEFERRED},
      {"definer", DEFINER},
!     {"delete", DELETE},
      {"delimiters", DELIMITERS},
      {"desc", DESC},
      {"distinct", DISTINCT},
--- 97,103 ----
      {"deferrable", DEFERRABLE},
      {"deferred", DEFERRED},
      {"definer", DEFINER},
!     {"delete", DELETE_P},
      {"delimiters", DELIMITERS},
      {"desc", DESC},
      {"distinct", DISTINCT},
***************
*** 120,126 ****
      {"extract", EXTRACT},
      {"false", FALSE_P},
      {"fetch", FETCH},
!     {"float", FLOAT},
      {"for", FOR},
      {"force", FORCE},
      {"foreign", FOREIGN},
--- 120,126 ----
      {"extract", EXTRACT},
      {"false", FALSE_P},
      {"fetch", FETCH},
!     {"float", FLOAT_P},
      {"for", FOR},
      {"force", FORCE},
      {"foreign", FOREIGN},
***************
*** 131,137 ****
      {"function", FUNCTION},
      {"global", GLOBAL},
      {"grant", GRANT},
!     {"group", GROUP},
      {"handler", HANDLER},
      {"having", HAVING},
      {"hour", HOUR_P},
--- 131,137 ----
      {"function", FUNCTION},
      {"global", GLOBAL},
      {"grant", GRANT},
!     {"group", GROUP_P},
      {"handler", HANDLER},
      {"having", HAVING},
      {"hour", HOUR_P},
***************
*** 139,145 ****
      {"immediate", IMMEDIATE},
      {"immutable", IMMUTABLE},
      {"implicit", IMPLICIT},
!     {"in", IN},
      {"increment", INCREMENT},
      {"index", INDEX},
      {"inherits", INHERITS},
--- 139,145 ----
      {"immediate", IMMEDIATE},
      {"immutable", IMMUTABLE},
      {"implicit", IMPLICIT},
!     {"in", IN_P},
      {"increment", INCREMENT},
      {"index", INDEX},
      {"inherits", INHERITS},
***************
*** 208,214 ****
      {"option", OPTION},
      {"or", OR},
      {"order", ORDER},
!     {"out", OUT},
      {"outer", OUTER_P},
      {"overlaps", OVERLAPS},
      {"owner", OWNER},
--- 208,214 ----
      {"option", OPTION},
      {"or", OR},
      {"order", ORDER},
!     {"out", OUT_P},
      {"outer", OUTER_P},
      {"overlaps", OVERLAPS},
      {"owner", OWNER},
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.275
diff -c -r1.275 postmaster.c
*** src/backend/postmaster/postmaster.c    2002/05/28 23:56:51    1.275
--- src/backend/postmaster/postmaster.c    2002/06/10 17:44:29
***************
*** 14,20 ****
   *
   *      The postmaster process creates the shared memory and semaphore
   *      pools during startup, but as a rule does not touch them itself.
!  *      In particular, it is not a member of the PROC array of backends
   *      and so it cannot participate in lock-manager operations.    Keeping
   *      the postmaster away from shared memory operations makes it simpler
   *      and more reliable.  The postmaster is almost always able to recover
--- 14,20 ----
   *
   *      The postmaster process creates the shared memory and semaphore
   *      pools during startup, but as a rule does not touch them itself.
!  *      In particular, it is not a member of the PGPROC array of backends
   *      and so it cannot participate in lock-manager operations.    Keeping
   *      the postmaster away from shared memory operations makes it simpler
   *      and more reliable.  The postmaster is almost always able to recover
Index: src/backend/storage/ipc/sinval.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v
retrieving revision 1.47
diff -c -r1.47 sinval.c
*** src/backend/storage/ipc/sinval.c    2002/05/24 18:57:56    1.47
--- src/backend/storage/ipc/sinval.c    2002/06/10 17:44:29
***************
*** 97,103 ****
           * The routines later in this file that use shared mode are okay with
           * this, because they aren't looking at the ProcState fields
           * associated with SI message transfer; they only use the
!          * ProcState array as an easy way to find all the PROC structures.
           */
          LWLockAcquire(SInvalLock, LW_SHARED);
          getResult = SIGetDataEntry(shmInvalBuffer, MyBackendId, &data);
--- 97,103 ----
           * The routines later in this file that use shared mode are okay with
           * this, because they aren't looking at the ProcState fields
           * associated with SI message transfer; they only use the
!          * ProcState array as an easy way to find all the PGPROC structures.
           */
          LWLockAcquire(SInvalLock, LW_SHARED);
          getResult = SIGetDataEntry(shmInvalBuffer, MyBackendId, &data);
***************
*** 130,141 ****


  /****************************************************************************/
! /* Functions that need to scan the PROC structures of all running backends. */
  /* It's a bit strange to keep these in sinval.c, since they don't have any    */
  /* direct relationship to shared-cache invalidation.  But the procState        */
  /* array in the SI segment is the only place in the system where we have    */
  /* an array of per-backend data, so it is the most convenient place to keep */
! /* pointers to the backends' PROC structures.  We used to implement these    */
  /* functions with a slow, ugly search through the ShmemIndex hash table --- */
  /* now they are simple loops over the SI ProcState array.                    */
  /****************************************************************************/
--- 130,141 ----


  /****************************************************************************/
! /* Functions that need to scan the PGPROC structures of all running backends. */
  /* It's a bit strange to keep these in sinval.c, since they don't have any    */
  /* direct relationship to shared-cache invalidation.  But the procState        */
  /* array in the SI segment is the only place in the system where we have    */
  /* an array of per-backend data, so it is the most convenient place to keep */
! /* pointers to the backends' PGPROC structures.  We used to implement these    */
  /* functions with a slow, ugly search through the ShmemIndex hash table --- */
  /* now they are simple loops over the SI ProcState array.                    */
  /****************************************************************************/
***************
*** 171,177 ****

          if (pOffset != INVALID_OFFSET)
          {
!             PROC       *proc = (PROC *) MAKE_PTR(pOffset);

              if (proc->databaseId == databaseId)
              {
--- 171,177 ----

          if (pOffset != INVALID_OFFSET)
          {
!             PGPROC       *proc = (PGPROC *) MAKE_PTR(pOffset);

              if (proc->databaseId == databaseId)
              {
***************
*** 208,214 ****

          if (pOffset != INVALID_OFFSET)
          {
!             PROC       *proc = (PROC *) MAKE_PTR(pOffset);

              /* Fetch xid just once - see GetNewTransactionId */
              TransactionId pxid = proc->xid;
--- 208,214 ----

          if (pOffset != INVALID_OFFSET)
          {
!             PGPROC       *proc = (PGPROC *) MAKE_PTR(pOffset);

              /* Fetch xid just once - see GetNewTransactionId */
              TransactionId pxid = proc->xid;
***************
*** 260,266 ****

          if (pOffset != INVALID_OFFSET)
          {
!             PROC       *proc = (PROC *) MAKE_PTR(pOffset);

              if (allDbs || proc->databaseId == MyDatabaseId)
              {
--- 260,266 ----

          if (pOffset != INVALID_OFFSET)
          {
!             PGPROC       *proc = (PGPROC *) MAKE_PTR(pOffset);

              if (allDbs || proc->databaseId == MyDatabaseId)
              {
***************
*** 371,377 ****

          if (pOffset != INVALID_OFFSET)
          {
!             PROC       *proc = (PROC *) MAKE_PTR(pOffset);

              /* Fetch xid just once - see GetNewTransactionId */
              TransactionId xid = proc->xid;
--- 371,377 ----

          if (pOffset != INVALID_OFFSET)
          {
!             PGPROC       *proc = (PGPROC *) MAKE_PTR(pOffset);

              /* Fetch xid just once - see GetNewTransactionId */
              TransactionId xid = proc->xid;
***************
*** 460,466 ****

          if (pOffset != INVALID_OFFSET)
          {
!             PROC       *proc = (PROC *) MAKE_PTR(pOffset);

              if (proc == MyProc)
                  continue;        /* do not count myself */
--- 460,466 ----

          if (pOffset != INVALID_OFFSET)
          {
!             PGPROC       *proc = (PGPROC *) MAKE_PTR(pOffset);

              if (proc == MyProc)
                  continue;        /* do not count myself */
***************
*** 476,482 ****
  }

  /*
!  * GetUndoRecPtr -- returns oldest PROC->logRec.
   */
  XLogRecPtr
  GetUndoRecPtr(void)
--- 476,482 ----
  }

  /*
!  * GetUndoRecPtr -- returns oldest PGPROC->logRec.
   */
  XLogRecPtr
  GetUndoRecPtr(void)
***************
*** 495,501 ****

          if (pOffset != INVALID_OFFSET)
          {
!             PROC       *proc = (PROC *) MAKE_PTR(pOffset);

              tempr = proc->logRec;
              if (tempr.xrecoff == 0)
--- 495,501 ----

          if (pOffset != INVALID_OFFSET)
          {
!             PGPROC       *proc = (PGPROC *) MAKE_PTR(pOffset);

              tempr = proc->logRec;
              if (tempr.xrecoff == 0)
***************
*** 512,524 ****
  }

  /*
!  * BackendIdGetProc - given a BackendId, find its PROC structure
   *
   * This is a trivial lookup in the ProcState array.  We assume that the caller
   * knows that the backend isn't going to go away, so we do not bother with
   * locking.
   */
! struct PROC *
  BackendIdGetProc(BackendId procId)
  {
      SISeg       *segP = shmInvalBuffer;
--- 512,524 ----
  }

  /*
!  * BackendIdGetProc - given a BackendId, find its PGPROC structure
   *
   * This is a trivial lookup in the ProcState array.  We assume that the caller
   * knows that the backend isn't going to go away, so we do not bother with
   * locking.
   */
! struct PGPROC *
  BackendIdGetProc(BackendId procId)
  {
      SISeg       *segP = shmInvalBuffer;
***************
*** 530,536 ****

          if (pOffset != INVALID_OFFSET)
          {
!             PROC       *proc = (PROC *) MAKE_PTR(pOffset);

              return proc;
          }
--- 530,536 ----

          if (pOffset != INVALID_OFFSET)
          {
!             PGPROC       *proc = (PGPROC *) MAKE_PTR(pOffset);

              return proc;
          }
Index: src/backend/storage/lmgr/deadlock.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v
retrieving revision 1.8
diff -c -r1.8 deadlock.c
*** src/backend/storage/lmgr/deadlock.c    2001/10/28 06:25:50    1.8
--- src/backend/storage/lmgr/deadlock.c    2002/06/10 17:44:29
***************
*** 31,38 ****
  /* One edge in the waits-for graph */
  typedef struct
  {
!     PROC       *waiter;            /* the waiting process */
!     PROC       *blocker;        /* the process it is waiting for */
      int            pred;            /* workspace for TopoSort */
      int            link;            /* workspace for TopoSort */
  } EDGE;
--- 31,38 ----
  /* One edge in the waits-for graph */
  typedef struct
  {
!     PGPROC       *waiter;            /* the waiting process */
!     PGPROC       *blocker;        /* the process it is waiting for */
      int            pred;            /* workspace for TopoSort */
      int            link;            /* workspace for TopoSort */
  } EDGE;
***************
*** 41,60 ****
  typedef struct
  {
      LOCK       *lock;            /* the lock whose wait queue is described */
!     PROC      **procs;            /* array of PROC *'s in new wait order */
      int            nProcs;
  } WAIT_ORDER;


! static bool DeadLockCheckRecurse(PROC *proc);
! static bool TestConfiguration(PROC *startProc);
! static bool FindLockCycle(PROC *checkProc,
                EDGE *softEdges, int *nSoftEdges);
! static bool FindLockCycleRecurse(PROC *checkProc,
                       EDGE *softEdges, int *nSoftEdges);
  static bool ExpandConstraints(EDGE *constraints, int nConstraints);
  static bool TopoSort(LOCK *lock, EDGE *constraints, int nConstraints,
!          PROC **ordering);

  #ifdef DEBUG_DEADLOCK
  static void PrintLockQueue(LOCK *lock, const char *info);
--- 41,60 ----
  typedef struct
  {
      LOCK       *lock;            /* the lock whose wait queue is described */
!     PGPROC      **procs;            /* array of PGPROC *'s in new wait order */
      int            nProcs;
  } WAIT_ORDER;


! static bool DeadLockCheckRecurse(PGPROC *proc);
! static bool TestConfiguration(PGPROC *startProc);
! static bool FindLockCycle(PGPROC *checkProc,
                EDGE *softEdges, int *nSoftEdges);
! static bool FindLockCycleRecurse(PGPROC *checkProc,
                       EDGE *softEdges, int *nSoftEdges);
  static bool ExpandConstraints(EDGE *constraints, int nConstraints);
  static bool TopoSort(LOCK *lock, EDGE *constraints, int nConstraints,
!          PGPROC **ordering);

  #ifdef DEBUG_DEADLOCK
  static void PrintLockQueue(LOCK *lock, const char *info);
***************
*** 66,83 ****
   */

  /* Workspace for FindLockCycle */
! static PROC **visitedProcs;        /* Array of visited procs */
  static int    nVisitedProcs;

  /* Workspace for TopoSort */
! static PROC **topoProcs;        /* Array of not-yet-output procs */
  static int *beforeConstraints;    /* Counts of remaining before-constraints */
  static int *afterConstraints;    /* List head for after-constraints */

  /* Output area for ExpandConstraints */
  static WAIT_ORDER *waitOrders;    /* Array of proposed queue rearrangements */
  static int    nWaitOrders;
! static PROC **waitOrderProcs;    /* Space for waitOrders queue contents */

  /* Current list of constraints being considered */
  static EDGE *curConstraints;
--- 66,83 ----
   */

  /* Workspace for FindLockCycle */
! static PGPROC **visitedProcs;        /* Array of visited procs */
  static int    nVisitedProcs;

  /* Workspace for TopoSort */
! static PGPROC **topoProcs;        /* Array of not-yet-output procs */
  static int *beforeConstraints;    /* Counts of remaining before-constraints */
  static int *afterConstraints;    /* List head for after-constraints */

  /* Output area for ExpandConstraints */
  static WAIT_ORDER *waitOrders;    /* Array of proposed queue rearrangements */
  static int    nWaitOrders;
! static PGPROC **waitOrderProcs;    /* Space for waitOrders queue contents */

  /* Current list of constraints being considered */
  static EDGE *curConstraints;
***************
*** 111,117 ****
      /*
       * FindLockCycle needs at most MaxBackends entries in visitedProcs[]
       */
!     visitedProcs = (PROC **) palloc(MaxBackends * sizeof(PROC *));

      /*
       * TopoSort needs to consider at most MaxBackends wait-queue entries,
--- 111,117 ----
      /*
       * FindLockCycle needs at most MaxBackends entries in visitedProcs[]
       */
!     visitedProcs = (PGPROC **) palloc(MaxBackends * sizeof(PGPROC *));

      /*
       * TopoSort needs to consider at most MaxBackends wait-queue entries,
***************
*** 128,134 ****
       * than MaxBackends total waiters.
       */
      waitOrders = (WAIT_ORDER *) palloc((MaxBackends / 2) * sizeof(WAIT_ORDER));
!     waitOrderProcs = (PROC **) palloc(MaxBackends * sizeof(PROC *));

      /*
       * Allow at most MaxBackends distinct constraints in a configuration.
--- 128,134 ----
       * than MaxBackends total waiters.
       */
      waitOrders = (WAIT_ORDER *) palloc((MaxBackends / 2) * sizeof(WAIT_ORDER));
!     waitOrderProcs = (PGPROC **) palloc(MaxBackends * sizeof(PGPROC *));

      /*
       * Allow at most MaxBackends distinct constraints in a configuration.
***************
*** 176,182 ****
   * interlocked!
   */
  bool
! DeadLockCheck(PROC *proc)
  {
      int            i,
                  j;
--- 176,182 ----
   * interlocked!
   */
  bool
! DeadLockCheck(PGPROC *proc)
  {
      int            i,
                  j;
***************
*** 194,200 ****
      for (i = 0; i < nWaitOrders; i++)
      {
          LOCK       *lock = waitOrders[i].lock;
!         PROC      **procs = waitOrders[i].procs;
          int            nProcs = waitOrders[i].nProcs;
          PROC_QUEUE *waitQueue = &(lock->waitProcs);

--- 194,200 ----
      for (i = 0; i < nWaitOrders; i++)
      {
          LOCK       *lock = waitOrders[i].lock;
!         PGPROC      **procs = waitOrders[i].procs;
          int            nProcs = waitOrders[i].nProcs;
          PROC_QUEUE *waitQueue = &(lock->waitProcs);

***************
*** 234,240 ****
   * rearrangements of lock wait queues (if any).
   */
  static bool
! DeadLockCheckRecurse(PROC *proc)
  {
      int            nEdges;
      int            oldPossibleConstraints;
--- 234,240 ----
   * rearrangements of lock wait queues (if any).
   */
  static bool
! DeadLockCheckRecurse(PGPROC *proc)
  {
      int            nEdges;
      int            oldPossibleConstraints;
***************
*** 300,306 ****
   *--------------------
   */
  static bool
! TestConfiguration(PROC *startProc)
  {
      int            softFound = 0;
      EDGE       *softEdges = possibleConstraints + nPossibleConstraints;
--- 300,306 ----
   *--------------------
   */
  static bool
! TestConfiguration(PGPROC *startProc)
  {
      int            softFound = 0;
      EDGE       *softEdges = possibleConstraints + nPossibleConstraints;
***************
*** 365,371 ****
   * be believed in preference to the actual ordering seen in the locktable.
   */
  static bool
! FindLockCycle(PROC *checkProc,
                EDGE *softEdges,    /* output argument */
                int *nSoftEdges)    /* output argument */
  {
--- 365,371 ----
   * be believed in preference to the actual ordering seen in the locktable.
   */
  static bool
! FindLockCycle(PGPROC *checkProc,
                EDGE *softEdges,    /* output argument */
                int *nSoftEdges)    /* output argument */
  {
***************
*** 375,385 ****
  }

  static bool
! FindLockCycleRecurse(PROC *checkProc,
                       EDGE *softEdges,    /* output argument */
                       int *nSoftEdges)    /* output argument */
  {
!     PROC       *proc;
      LOCK       *lock;
      HOLDER       *holder;
      SHM_QUEUE  *lockHolders;
--- 375,385 ----
  }

  static bool
! FindLockCycleRecurse(PGPROC *checkProc,
                       EDGE *softEdges,    /* output argument */
                       int *nSoftEdges)    /* output argument */
  {
!     PGPROC       *proc;
      LOCK       *lock;
      HOLDER       *holder;
      SHM_QUEUE  *lockHolders;
***************
*** 438,444 ****

      while (holder)
      {
!         proc = (PROC *) MAKE_PTR(holder->tag.proc);

          /* A proc never blocks itself */
          if (proc != checkProc)
--- 438,444 ----

      while (holder)
      {
!         proc = (PGPROC *) MAKE_PTR(holder->tag.proc);

          /* A proc never blocks itself */
          if (proc != checkProc)
***************
*** 480,486 ****
      if (i < nWaitOrders)
      {
          /* Use the given hypothetical wait queue order */
!         PROC      **procs = waitOrders[i].procs;

          queue_size = waitOrders[i].nProcs;

--- 480,486 ----
      if (i < nWaitOrders)
      {
          /* Use the given hypothetical wait queue order */
!         PGPROC      **procs = waitOrders[i].procs;

          queue_size = waitOrders[i].nProcs;

***************
*** 517,523 ****
          waitQueue = &(lock->waitProcs);
          queue_size = waitQueue->size;

!         proc = (PROC *) MAKE_PTR(waitQueue->links.next);

          while (queue_size-- > 0)
          {
--- 517,523 ----
          waitQueue = &(lock->waitProcs);
          queue_size = waitQueue->size;

!         proc = (PGPROC *) MAKE_PTR(waitQueue->links.next);

          while (queue_size-- > 0)
          {
***************
*** 543,549 ****
                  }
              }

!             proc = (PROC *) MAKE_PTR(proc->links.next);
          }
      }

--- 543,549 ----
                  }
              }

!             proc = (PGPROC *) MAKE_PTR(proc->links.next);
          }
      }

***************
*** 559,565 ****
   *        specific new orderings for affected wait queues
   *
   * Input is a list of soft edges to be reversed.  The output is a list
!  * of nWaitOrders WAIT_ORDER structs in waitOrders[], with PROC array
   * workspace in waitOrderProcs[].
   *
   * Returns TRUE if able to build an ordering that satisfies all the
--- 559,565 ----
   *        specific new orderings for affected wait queues
   *
   * Input is a list of soft edges to be reversed.  The output is a list
!  * of nWaitOrders WAIT_ORDER structs in waitOrders[], with PGPROC array
   * workspace in waitOrderProcs[].
   *
   * Returns TRUE if able to build an ordering that satisfies all the
***************
*** 582,588 ****
       */
      for (i = nConstraints; --i >= 0;)
      {
!         PROC       *proc = constraints[i].waiter;
          LOCK       *lock = proc->waitLock;

          /* Did we already make a list for this lock? */
--- 582,588 ----
       */
      for (i = nConstraints; --i >= 0;)
      {
!         PGPROC       *proc = constraints[i].waiter;
          LOCK       *lock = proc->waitLock;

          /* Did we already make a list for this lock? */
***************
*** 628,634 ****
   * slowness of the algorithm won't really matter.
   *
   * The initial queue ordering is taken directly from the lock's wait queue.
!  * The output is an array of PROC pointers, of length equal to the lock's
   * wait queue length (the caller is responsible for providing this space).
   * The partial order is specified by an array of EDGE structs.    Each EDGE
   * is one that we need to reverse, therefore the "waiter" must appear before
--- 628,634 ----
   * slowness of the algorithm won't really matter.
   *
   * The initial queue ordering is taken directly from the lock's wait queue.
!  * The output is an array of PGPROC pointers, of length equal to the lock's
   * wait queue length (the caller is responsible for providing this space).
   * The partial order is specified by an array of EDGE structs.    Each EDGE
   * is one that we need to reverse, therefore the "waiter" must appear before
***************
*** 642,663 ****
  TopoSort(LOCK *lock,
           EDGE *constraints,
           int nConstraints,
!          PROC **ordering)        /* output argument */
  {
      PROC_QUEUE *waitQueue = &(lock->waitProcs);
      int            queue_size = waitQueue->size;
!     PROC       *proc;
      int            i,
                  j,
                  k,
                  last;

      /* First, fill topoProcs[] array with the procs in their current order */
!     proc = (PROC *) MAKE_PTR(waitQueue->links.next);
      for (i = 0; i < queue_size; i++)
      {
          topoProcs[i] = proc;
!         proc = (PROC *) MAKE_PTR(proc->links.next);
      }

      /*
--- 642,663 ----
  TopoSort(LOCK *lock,
           EDGE *constraints,
           int nConstraints,
!          PGPROC **ordering)        /* output argument */
  {
      PROC_QUEUE *waitQueue = &(lock->waitProcs);
      int            queue_size = waitQueue->size;
!     PGPROC       *proc;
      int            i,
                  j,
                  k,
                  last;

      /* First, fill topoProcs[] array with the procs in their current order */
!     proc = (PGPROC *) MAKE_PTR(waitQueue->links.next);
      for (i = 0; i < queue_size; i++)
      {
          topoProcs[i] = proc;
!         proc = (PGPROC *) MAKE_PTR(proc->links.next);
      }

      /*
***************
*** 743,757 ****
  {
      PROC_QUEUE *waitQueue = &(lock->waitProcs);
      int            queue_size = waitQueue->size;
!     PROC       *proc;
      int            i;

      printf("%s lock %lx queue ", info, MAKE_OFFSET(lock));
!     proc = (PROC *) MAKE_PTR(waitQueue->links.next);
      for (i = 0; i < queue_size; i++)
      {
          printf(" %d", proc->pid);
!         proc = (PROC *) MAKE_PTR(proc->links.next);
      }
      printf("\n");
      fflush(stdout);
--- 743,757 ----
  {
      PROC_QUEUE *waitQueue = &(lock->waitProcs);
      int            queue_size = waitQueue->size;
!     PGPROC       *proc;
      int            i;

      printf("%s lock %lx queue ", info, MAKE_OFFSET(lock));
!     proc = (PGPROC *) MAKE_PTR(waitQueue->links.next);
      for (i = 0; i < queue_size; i++)
      {
          printf(" %d", proc->pid);
!         proc = (PGPROC *) MAKE_PTR(proc->links.next);
      }
      printf("\n");
      fflush(stdout);
Index: src/backend/storage/lmgr/lock.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v
retrieving revision 1.106
diff -c -r1.106 lock.c
*** src/backend/storage/lmgr/lock.c    2002/03/06 06:10:06    1.106
--- src/backend/storage/lmgr/lock.c    2002/06/10 17:44:29
***************
*** 49,55 ****

  static int WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
             LOCK *lock, HOLDER *holder);
! static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc,
                   int *myHolding);

  static char *lock_mode_names[] =
--- 49,55 ----

  static int WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
             LOCK *lock, HOLDER *holder);
! static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PGPROC *proc,
                   int *myHolding);

  static char *lock_mode_names[] =
***************
*** 746,752 ****
                     LOCKMODE lockmode,
                     LOCK *lock,
                     HOLDER *holder,
!                    PROC *proc,
                     int *myHolding)        /* myHolding[] array or NULL */
  {
      LOCKMETHODCTL *lockctl = lockMethodTable->ctl;
--- 746,752 ----
                     LOCKMODE lockmode,
                     LOCK *lock,
                     HOLDER *holder,
!                    PGPROC *proc,
                     int *myHolding)        /* myHolding[] array or NULL */
  {
      LOCKMETHODCTL *lockctl = lockMethodTable->ctl;
***************
*** 820,826 ****
   * be a net slowdown.
   */
  static void
! LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding)
  {
      SHM_QUEUE  *procHolders = &(proc->procHolders);
      HOLDER       *holder;
--- 820,826 ----
   * be a net slowdown.
   */
  static void
! LockCountMyLocks(SHMEM_OFFSET lockOffset, PGPROC *proc, int *myHolding)
  {
      SHM_QUEUE  *procHolders = &(proc->procHolders);
      HOLDER       *holder;
***************
*** 944,950 ****
   * this routine can only happen if we are aborting the transaction.)
   */
  void
! RemoveFromWaitQueue(PROC *proc)
  {
      LOCK       *waitLock = proc->waitLock;
      LOCKMODE    lockmode = proc->waitLockMode;
--- 944,950 ----
   * this routine can only happen if we are aborting the transaction.)
   */
  void
! RemoveFromWaitQueue(PGPROC *proc)
  {
      LOCK       *waitLock = proc->waitLock;
      LOCKMODE    lockmode = proc->waitLockMode;
***************
*** 1182,1188 ****
   * specified XID are released.
   */
  bool
! LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc,
                 bool allxids, TransactionId xid)
  {
      SHM_QUEUE  *procHolders = &(proc->procHolders);
--- 1182,1188 ----
   * specified XID are released.
   */
  bool
! LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
                 bool allxids, TransactionId xid)
  {
      SHM_QUEUE  *procHolders = &(proc->procHolders);
***************
*** 1354,1360 ****
      long        max_table_size = NLOCKENTS(maxBackends);

      size += MAXALIGN(sizeof(PROC_HDR)); /* ProcGlobal */
!     size += maxBackends * MAXALIGN(sizeof(PROC));        /* each MyProc */
      size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL)); /* each
                                                                   * lockMethodTable->ctl */

--- 1354,1360 ----
      long        max_table_size = NLOCKENTS(maxBackends);

      size += MAXALIGN(sizeof(PROC_HDR)); /* ProcGlobal */
!     size += maxBackends * MAXALIGN(sizeof(PGPROC));        /* each MyProc */
      size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL)); /* each
                                                                   * lockMethodTable->ctl */

***************
*** 1383,1389 ****
  void
  DumpLocks(void)
  {
!     PROC       *proc;
      SHM_QUEUE  *procHolders;
      HOLDER       *holder;
      LOCK       *lock;
--- 1383,1389 ----
  void
  DumpLocks(void)
  {
!     PGPROC       *proc;
      SHM_QUEUE  *procHolders;
      HOLDER       *holder;
      LOCK       *lock;
***************
*** 1427,1433 ****
  void
  DumpAllLocks(void)
  {
!     PROC       *proc;
      HOLDER       *holder;
      LOCK       *lock;
      int            lockmethod = DEFAULT_LOCKMETHOD;
--- 1427,1433 ----
  void
  DumpAllLocks(void)
  {
!     PGPROC       *proc;
      HOLDER       *holder;
      LOCK       *lock;
      int            lockmethod = DEFAULT_LOCKMETHOD;
Index: src/backend/storage/lmgr/lwlock.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v
retrieving revision 1.10
diff -c -r1.10 lwlock.c
*** src/backend/storage/lmgr/lwlock.c    2002/05/05 00:03:28    1.10
--- src/backend/storage/lmgr/lwlock.c    2002/06/10 17:44:30
***************
*** 29,40 ****

  typedef struct LWLock
  {
!     slock_t        mutex;            /* Protects LWLock and queue of PROCs */
      bool        releaseOK;        /* T if ok to release waiters */
      char        exclusive;        /* # of exclusive holders (0 or 1) */
      int            shared;            /* # of shared holders (0..MaxBackends) */
!     PROC       *head;            /* head of list of waiting PROCs */
!     PROC       *tail;            /* tail of list of waiting PROCs */
      /* tail is undefined when head is NULL */
  } LWLock;

--- 29,40 ----

  typedef struct LWLock
  {
!     slock_t        mutex;            /* Protects LWLock and queue of PGPROCs */
      bool        releaseOK;        /* T if ok to release waiters */
      char        exclusive;        /* # of exclusive holders (0 or 1) */
      int            shared;            /* # of shared holders (0..MaxBackends) */
!     PGPROC       *head;            /* head of list of waiting PGPROCs */
!     PGPROC       *tail;            /* tail of list of waiting PGPROCs */
      /* tail is undefined when head is NULL */
  } LWLock;

***************
*** 197,203 ****
  LWLockAcquire(LWLockId lockid, LWLockMode mode)
  {
      volatile LWLock *lock = LWLockArray + lockid;
!     PROC       *proc = MyProc;
      bool        retry = false;
      int            extraWaits = 0;

--- 197,203 ----
  LWLockAcquire(LWLockId lockid, LWLockMode mode)
  {
      volatile LWLock *lock = LWLockArray + lockid;
!     PGPROC       *proc = MyProc;
      bool        retry = false;
      int            extraWaits = 0;

***************
*** 266,277 ****
          /*
           * Add myself to wait queue.
           *
!          * If we don't have a PROC structure, there's no way to wait. This
           * should never occur, since MyProc should only be null during
           * shared memory initialization.
           */
          if (proc == NULL)
!             elog(FATAL, "LWLockAcquire: can't wait without a PROC structure");

          proc->lwWaiting = true;
          proc->lwExclusive = (mode == LW_EXCLUSIVE);
--- 266,277 ----
          /*
           * Add myself to wait queue.
           *
!          * If we don't have a PGPROC structure, there's no way to wait. This
           * should never occur, since MyProc should only be null during
           * shared memory initialization.
           */
          if (proc == NULL)
!             elog(FATAL, "LWLockAcquire: can't wait without a PGPROC structure");

          proc->lwWaiting = true;
          proc->lwExclusive = (mode == LW_EXCLUSIVE);
***************
*** 401,408 ****
  LWLockRelease(LWLockId lockid)
  {
      volatile LWLock *lock = LWLockArray + lockid;
!     PROC       *head;
!     PROC       *proc;
      int            i;

      PRINT_LWDEBUG("LWLockRelease", lockid, lock);
--- 401,408 ----
  LWLockRelease(LWLockId lockid)
  {
      volatile LWLock *lock = LWLockArray + lockid;
!     PGPROC       *head;
!     PGPROC       *proc;
      int            i;

      PRINT_LWDEBUG("LWLockRelease", lockid, lock);
***************
*** 446,452 ****
          if (lock->exclusive == 0 && lock->shared == 0 && lock->releaseOK)
          {
              /*
!              * Remove the to-be-awakened PROCs from the queue.  If the
               * front waiter wants exclusive lock, awaken him only.
               * Otherwise awaken as many waiters as want shared access.
               */
--- 446,452 ----
          if (lock->exclusive == 0 && lock->shared == 0 && lock->releaseOK)
          {
              /*
!              * Remove the to-be-awakened PGPROCs from the queue.  If the
               * front waiter wants exclusive lock, awaken him only.
               * Otherwise awaken as many waiters as want shared access.
               */
***************
*** 459,465 ****
                      proc = proc->lwWaitLink;
                  }
              }
!             /* proc is now the last PROC to be released */
              lock->head = proc->lwWaitLink;
              proc->lwWaitLink = NULL;
              /* prevent additional wakeups until retryer gets to run */
--- 459,465 ----
                      proc = proc->lwWaitLink;
                  }
              }
!             /* proc is now the last PGPROC to be released */
              lock->head = proc->lwWaitLink;
              proc->lwWaitLink = NULL;
              /* prevent additional wakeups until retryer gets to run */
Index: src/backend/storage/lmgr/proc.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v
retrieving revision 1.119
diff -c -r1.119 proc.c
*** src/backend/storage/lmgr/proc.c    2002/05/05 00:03:28    1.119
--- src/backend/storage/lmgr/proc.c    2002/06/10 17:44:30
***************
*** 55,66 ****

  int            DeadlockTimeout = 1000;

! PROC       *MyProc = NULL;

  /*
!  * This spinlock protects the freelist of recycled PROC structures.
   * We cannot use an LWLock because the LWLock manager depends on already
!  * having a PROC and a wait semaphore!  But these structures are touched
   * relatively infrequently (only at backend startup or shutdown) and not for
   * very long, so a spinlock is okay.
   */
--- 55,66 ----

  int            DeadlockTimeout = 1000;

! PGPROC       *MyProc = NULL;

  /*
!  * This spinlock protects the freelist of recycled PGPROC structures.
   * We cannot use an LWLock because the LWLock manager depends on already
!  * having a PGPROC and a wait semaphore!  But these structures are touched
   * relatively infrequently (only at backend startup or shutdown) and not for
   * very long, so a spinlock is okay.
   */
***************
*** 68,74 ****

  static PROC_HDR *ProcGlobal = NULL;

! static PROC *DummyProc = NULL;

  static bool waitingForLock = false;
  static bool waitingForSignal = false;
--- 68,74 ----

  static PROC_HDR *ProcGlobal = NULL;

! static PGPROC *DummyProc = NULL;

  static bool waitingForLock = false;
  static bool waitingForSignal = false;
***************
*** 129,157 ****
          ProcGlobal->freeProcs = INVALID_OFFSET;

          /*
!          * Pre-create the PROC structures and create a semaphore for each.
           */
          for (i = 0; i < maxBackends; i++)
          {
!             PROC   *proc;

!             proc = (PROC *) ShmemAlloc(sizeof(PROC));
              if (!proc)
                  elog(FATAL, "cannot create new proc: out of memory");
!             MemSet(proc, 0, sizeof(PROC));
              PGSemaphoreCreate(&proc->sem);
              proc->links.next = ProcGlobal->freeProcs;
              ProcGlobal->freeProcs = MAKE_OFFSET(proc);
          }

          /*
!          * Pre-allocate a PROC structure for dummy (checkpoint) processes,
           * too.  This does not get linked into the freeProcs list.
           */
!         DummyProc = (PROC *) ShmemAlloc(sizeof(PROC));
          if (!DummyProc)
              elog(FATAL, "cannot create new proc: out of memory");
!         MemSet(DummyProc, 0, sizeof(PROC));
          DummyProc->pid = 0;        /* marks DummyProc as not in use */
          PGSemaphoreCreate(&DummyProc->sem);

--- 129,157 ----
          ProcGlobal->freeProcs = INVALID_OFFSET;

          /*
!          * Pre-create the PGPROC structures and create a semaphore for each.
           */
          for (i = 0; i < maxBackends; i++)
          {
!             PGPROC   *proc;

!             proc = (PGPROC *) ShmemAlloc(sizeof(PGPROC));
              if (!proc)
                  elog(FATAL, "cannot create new proc: out of memory");
!             MemSet(proc, 0, sizeof(PGPROC));
              PGSemaphoreCreate(&proc->sem);
              proc->links.next = ProcGlobal->freeProcs;
              ProcGlobal->freeProcs = MAKE_OFFSET(proc);
          }

          /*
!          * Pre-allocate a PGPROC structure for dummy (checkpoint) processes,
           * too.  This does not get linked into the freeProcs list.
           */
!         DummyProc = (PGPROC *) ShmemAlloc(sizeof(PGPROC));
          if (!DummyProc)
              elog(FATAL, "cannot create new proc: out of memory");
!         MemSet(DummyProc, 0, sizeof(PGPROC));
          DummyProc->pid = 0;        /* marks DummyProc as not in use */
          PGSemaphoreCreate(&DummyProc->sem);

***************
*** 183,189 ****

      /*
       * Try to get a proc struct from the free list.  If this fails,
!      * we must be out of PROC structures (not to mention semaphores).
       */
      SpinLockAcquire(ProcStructLock);

--- 183,189 ----

      /*
       * Try to get a proc struct from the free list.  If this fails,
!      * we must be out of PGPROC structures (not to mention semaphores).
       */
      SpinLockAcquire(ProcStructLock);

***************
*** 191,204 ****

      if (myOffset != INVALID_OFFSET)
      {
!         MyProc = (PROC *) MAKE_PTR(myOffset);
          procglobal->freeProcs = MyProc->links.next;
          SpinLockRelease(ProcStructLock);
      }
      else
      {
          /*
!          * If we reach here, all the PROCs are in use.  This is one of
           * the possible places to detect "too many backends", so give the
           * standard error message.
           */
--- 191,204 ----

      if (myOffset != INVALID_OFFSET)
      {
!         MyProc = (PGPROC *) MAKE_PTR(myOffset);
          procglobal->freeProcs = MyProc->links.next;
          SpinLockRelease(ProcStructLock);
      }
      else
      {
          /*
!          * If we reach here, all the PGPROCs are in use.  This is one of
           * the possible places to detect "too many backends", so give the
           * standard error message.
           */
***************
*** 236,242 ****
      PGSemaphoreReset(&MyProc->sem);

      /*
!      * Now that we have a PROC, we could try to acquire locks, so
       * initialize the deadlock checker.
       */
      InitDeadLockChecking();
--- 236,242 ----
      PGSemaphoreReset(&MyProc->sem);

      /*
!      * Now that we have a PGPROC, we could try to acquire locks, so
       * initialize the deadlock checker.
       */
      InitDeadLockChecking();
***************
*** 246,252 ****
   * InitDummyProcess -- create a dummy per-process data structure
   *
   * This is called by checkpoint processes so that they will have a MyProc
!  * value that's real enough to let them wait for LWLocks.  The PROC and
   * sema that are assigned are the extra ones created during InitProcGlobal.
   */
  void
--- 246,252 ----
   * InitDummyProcess -- create a dummy per-process data structure
   *
   * This is called by checkpoint processes so that they will have a MyProc
!  * value that's real enough to let them wait for LWLocks.  The PGPROC and
   * sema that are assigned are the extra ones created during InitProcGlobal.
   */
  void
***************
*** 402,412 ****

      SpinLockAcquire(ProcStructLock);

!     /* Return PROC structure (and semaphore) to freelist */
      MyProc->links.next = procglobal->freeProcs;
      procglobal->freeProcs = MAKE_OFFSET(MyProc);

!     /* PROC struct isn't mine anymore */
      MyProc = NULL;

      SpinLockRelease(ProcStructLock);
--- 402,412 ----

      SpinLockAcquire(ProcStructLock);

!     /* Return PGPROC structure (and semaphore) to freelist */
      MyProc->links.next = procglobal->freeProcs;
      procglobal->freeProcs = MAKE_OFFSET(MyProc);

!     /* PGPROC struct isn't mine anymore */
      MyProc = NULL;

      SpinLockRelease(ProcStructLock);
***************
*** 414,420 ****

  /*
   * DummyProcKill() -- Cut-down version of ProcKill for dummy (checkpoint)
!  *        processes.    The PROC and sema are not released, only marked
   *        as not-in-use.
   */
  static void
--- 414,420 ----

  /*
   * DummyProcKill() -- Cut-down version of ProcKill for dummy (checkpoint)
!  *        processes.    The PGPROC and sema are not released, only marked
   *        as not-in-use.
   */
  static void
***************
*** 433,439 ****
      /* Mark DummyProc no longer in use */
      MyProc->pid = 0;

!     /* PROC struct isn't mine anymore */
      MyProc = NULL;
  }

--- 433,439 ----
      /* Mark DummyProc no longer in use */
      MyProc->pid = 0;

!     /* PGPROC struct isn't mine anymore */
      MyProc = NULL;
  }

***************
*** 506,512 ****
      PROC_QUEUE *waitQueue = &(lock->waitProcs);
      int            myHeldLocks = MyProc->heldLocks;
      bool        early_deadlock = false;
!     PROC       *proc;
      int            i;

      /*
--- 506,512 ----
      PROC_QUEUE *waitQueue = &(lock->waitProcs);
      int            myHeldLocks = MyProc->heldLocks;
      bool        early_deadlock = false;
!     PGPROC       *proc;
      int            i;

      /*
***************
*** 531,537 ****
      {
          int            aheadRequests = 0;

!         proc = (PROC *) MAKE_PTR(waitQueue->links.next);
          for (i = 0; i < waitQueue->size; i++)
          {
              /* Must he wait for me? */
--- 531,537 ----
      {
          int            aheadRequests = 0;

!         proc = (PGPROC *) MAKE_PTR(waitQueue->links.next);
          for (i = 0; i < waitQueue->size; i++)
          {
              /* Must he wait for me? */
***************
*** 568,574 ****
              }
              /* Nope, so advance to next waiter */
              aheadRequests |= (1 << proc->waitLockMode);
!             proc = (PROC *) MAKE_PTR(proc->links.next);
          }

          /*
--- 568,574 ----
              }
              /* Nope, so advance to next waiter */
              aheadRequests |= (1 << proc->waitLockMode);
!             proc = (PGPROC *) MAKE_PTR(proc->links.next);
          }

          /*
***************
*** 579,585 ****
      else
      {
          /* I hold no locks, so I can't push in front of anyone. */
!         proc = (PROC *) &(waitQueue->links);
      }

      /*
--- 579,585 ----
      else
      {
          /* I hold no locks, so I can't push in front of anyone. */
!         proc = (PGPROC *) &(waitQueue->links);
      }

      /*
***************
*** 591,597 ****

      lock->waitMask |= (1 << lockmode);

!     /* Set up wait information in PROC object, too */
      MyProc->waitLock = lock;
      MyProc->waitHolder = holder;
      MyProc->waitLockMode = lockmode;
--- 591,597 ----

      lock->waitMask |= (1 << lockmode);

!     /* Set up wait information in PGPROC object, too */
      MyProc->waitLock = lock;
      MyProc->waitHolder = holder;
      MyProc->waitLockMode = lockmode;
***************
*** 685,704 ****
   * works correctly for that case.  To clean up in failure case, would need
   * to twiddle the lock's request counts too --- see RemoveFromWaitQueue.
   */
! PROC *
! ProcWakeup(PROC *proc, int errType)
  {
!     PROC       *retProc;

      /* assume that masterLock has been acquired */

      /* Proc should be sleeping ... */
      if (proc->links.prev == INVALID_OFFSET ||
          proc->links.next == INVALID_OFFSET)
!         return (PROC *) NULL;

      /* Save next process before we zap the list link */
!     retProc = (PROC *) MAKE_PTR(proc->links.next);

      /* Remove process from wait queue */
      SHMQueueDelete(&(proc->links));
--- 685,704 ----
   * works correctly for that case.  To clean up in failure case, would need
   * to twiddle the lock's request counts too --- see RemoveFromWaitQueue.
   */
! PGPROC *
! ProcWakeup(PGPROC *proc, int errType)
  {
!     PGPROC       *retProc;

      /* assume that masterLock has been acquired */

      /* Proc should be sleeping ... */
      if (proc->links.prev == INVALID_OFFSET ||
          proc->links.next == INVALID_OFFSET)
!         return (PGPROC *) NULL;

      /* Save next process before we zap the list link */
!     retProc = (PGPROC *) MAKE_PTR(proc->links.next);

      /* Remove process from wait queue */
      SHMQueueDelete(&(proc->links));
***************
*** 726,732 ****
      LOCKMETHODCTL *lockctl = lockMethodTable->ctl;
      PROC_QUEUE *waitQueue = &(lock->waitProcs);
      int            queue_size = waitQueue->size;
!     PROC       *proc;
      int            aheadRequests = 0;

      Assert(queue_size >= 0);
--- 726,732 ----
      LOCKMETHODCTL *lockctl = lockMethodTable->ctl;
      PROC_QUEUE *waitQueue = &(lock->waitProcs);
      int            queue_size = waitQueue->size;
!     PGPROC       *proc;
      int            aheadRequests = 0;

      Assert(queue_size >= 0);
***************
*** 734,740 ****
      if (queue_size == 0)
          return;

!     proc = (PROC *) MAKE_PTR(waitQueue->links.next);

      while (queue_size-- > 0)
      {
--- 734,740 ----
      if (queue_size == 0)
          return;

!     proc = (PGPROC *) MAKE_PTR(waitQueue->links.next);

      while (queue_size-- > 0)
      {
***************
*** 769,775 ****
               * checks.
               */
              aheadRequests |= (1 << lockmode);
!             proc = (PROC *) MAKE_PTR(proc->links.next);
          }
      }

--- 769,775 ----
               * checks.
               */
              aheadRequests |= (1 << lockmode);
!             proc = (PGPROC *) MAKE_PTR(proc->links.next);
          }
      }

***************
*** 902,908 ****
  void
  ProcSendSignal(BackendId procId)
  {
!     PROC       *proc = BackendIdGetProc(procId);

      if (proc != NULL)
          PGSemaphoreUnlock(&proc->sem);
--- 902,908 ----
  void
  ProcSendSignal(BackendId procId)
  {
!     PGPROC       *proc = BackendIdGetProc(procId);

      if (proc != NULL)
          PGSemaphoreUnlock(&proc->sem);
Index: src/backend/utils/adt/date.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/date.c,v
retrieving revision 1.67
diff -c -r1.67 date.c
*** src/backend/utils/adt/date.c    2002/06/01 15:52:15    1.67
--- src/backend/utils/adt/date.c    2002/06/10 17:44:30
***************
*** 69,75 ****
          case DTK_CURRENT:
              elog(ERROR, "Date CURRENT no longer supported"
                   "\n\tdate_in() internal coding error");
!             GetCurrentTime(tm);
              break;

          case DTK_EPOCH:
--- 69,75 ----
          case DTK_CURRENT:
              elog(ERROR, "Date CURRENT no longer supported"
                   "\n\tdate_in() internal coding error");
!             GetCurrentDateTime(tm);
              break;

          case DTK_EPOCH:
***************
*** 1697,1703 ****
      fsec_t        fsec;
      int            tz;

!     GetCurrentTime(tm);
      time2tm(time, tm, &fsec);
      tz = DetermineLocalTimeZone(tm);

--- 1697,1703 ----
      fsec_t        fsec;
      int            tz;

!     GetCurrentDateTime(tm);
      time2tm(time, tm, &fsec);
      tz = DetermineLocalTimeZone(tm);

Index: src/backend/utils/adt/datetime.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/datetime.c,v
retrieving revision 1.90
diff -c -r1.90 datetime.c
*** src/backend/utils/adt/datetime.c    2002/05/17 01:19:18    1.90
--- src/backend/utils/adt/datetime.c    2002/06/10 17:44:31
***************
*** 83,89 ****
      {"acst", DTZ, NEG(24)},        /* Atlantic/Porto Acre */
      {"act", TZ, NEG(30)},        /* Atlantic/Porto Acre */
      {DA_D, ADBC, AD},            /* "ad" for years >= 0 */
!     {"abstime", IGNORE, 0},        /* for pre-v6.1 "Invalid Abstime" */
      {"adt", DTZ, NEG(18)},        /* Atlantic Daylight Time */
      {"aesst", DTZ, 66},            /* E. Australia */
      {"aest", TZ, 60},            /* Australia Eastern Std Time */
--- 83,89 ----
      {"acst", DTZ, NEG(24)},        /* Atlantic/Porto Acre */
      {"act", TZ, NEG(30)},        /* Atlantic/Porto Acre */
      {DA_D, ADBC, AD},            /* "ad" for years >= 0 */
!     {"abstime", IGNORE_DTF, 0},        /* for pre-v6.1 "Invalid Abstime" */
      {"adt", DTZ, NEG(18)},        /* Atlantic Daylight Time */
      {"aesst", DTZ, 66},            /* E. Australia */
      {"aest", TZ, 60},            /* Australia Eastern Std Time */
***************
*** 115,121 ****
      {"apr", MONTH, 4},
      {"april", MONTH, 4},
      {"ast", TZ, NEG(24)},        /* Atlantic Std Time (Canada) */
!     {"at", IGNORE, 0},            /* "at" (throwaway) */
      {"aug", MONTH, 8},
      {"august", MONTH, 8},
      {"awsst", DTZ, 54},            /* W. Australia */
--- 115,121 ----
      {"apr", MONTH, 4},
      {"april", MONTH, 4},
      {"ast", TZ, NEG(24)},        /* Atlantic Std Time (Canada) */
!     {"at", IGNORE_DTF, 0},            /* "at" (throwaway) */
      {"aug", MONTH, 8},
      {"august", MONTH, 8},
      {"awsst", DTZ, 54},            /* W. Australia */
***************
*** 348,354 ****
      {"october", MONTH, 10},
      {"omsst", DTZ, 42},            /* Omsk Summer Time */
      {"omst", TZ, 36},            /* Omsk Time */
!     {"on", IGNORE, 0},            /* "on" (throwaway) */
      {"pdt", DTZ, NEG(42)},        /* Pacific Daylight Time */
  #if 0
  pest
--- 348,354 ----
      {"october", MONTH, 10},
      {"omsst", DTZ, 42},            /* Omsk Summer Time */
      {"omst", TZ, 36},            /* Omsk Time */
!     {"on", IGNORE_DTF, 0},            /* "on" (throwaway) */
      {"pdt", DTZ, NEG(42)},        /* Pacific Daylight Time */
  #if 0
  pest
***************
*** 494,500 ****

  static datetkn deltatktbl[] = {
      /* text, token, lexval */
!     {"@", IGNORE, 0},            /* postgres relative prefix */
      {DAGO, AGO, 0},                /* "ago" indicates negative time offset */
      {"c", UNITS, DTK_CENTURY},    /* "century" relative */
      {"cent", UNITS, DTK_CENTURY},        /* "century" relative */
--- 494,500 ----

  static datetkn deltatktbl[] = {
      /* text, token, lexval */
!     {"@", IGNORE_DTF, 0},            /* postgres relative prefix */
      {DAGO, AGO, 0},                /* "ago" indicates negative time offset */
      {"c", UNITS, DTK_CENTURY},    /* "century" relative */
      {"cent", UNITS, DTK_CENTURY},        /* "century" relative */
***************
*** 536,542 ****
      {"msecs", UNITS, DTK_MILLISEC},
      {"qtr", UNITS, DTK_QUARTER},    /* "quarter" relative */
      {DQUARTER, UNITS, DTK_QUARTER},        /* "quarter" relative */
!     {"reltime", IGNORE, 0},        /* pre-v6.1 "Undefined Reltime" */
      {"s", UNITS, DTK_SECOND},
      {"sec", UNITS, DTK_SECOND},
      {DSECOND, UNITS, DTK_SECOND},
--- 536,542 ----
      {"msecs", UNITS, DTK_MILLISEC},
      {"qtr", UNITS, DTK_QUARTER},    /* "quarter" relative */
      {DQUARTER, UNITS, DTK_QUARTER},        /* "quarter" relative */
!     {"reltime", IGNORE_DTF, 0},        /* pre-v6.1 "Undefined Reltime" */
      {"s", UNITS, DTK_SECOND},
      {"sec", UNITS, DTK_SECOND},
      {DSECOND, UNITS, DTK_SECOND},
***************
*** 1198,1204 ****
              case DTK_STRING:
              case DTK_SPECIAL:
                  type = DecodeSpecial(i, field[i], &val);
!                 if (type == IGNORE)
                      continue;

                  tmask = DTK_M(type);
--- 1198,1204 ----
              case DTK_STRING:
              case DTK_SPECIAL:
                  type = DecodeSpecial(i, field[i], &val);
!                 if (type == IGNORE_DTF)
                      continue;

                  tmask = DTK_M(type);
***************
*** 1223,1229 ****
                              case DTK_YESTERDAY:
                                  tmask = DTK_DATE_M;
                                  *dtype = DTK_DATE;
!                                 GetCurrentTime(tm);
                                  j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1),
                                  &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
                                  tm->tm_hour = 0;
--- 1223,1229 ----
                              case DTK_YESTERDAY:
                                  tmask = DTK_DATE_M;
                                  *dtype = DTK_DATE;
!                                 GetCurrentDateTime(tm);
                                  j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1),
                                  &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
                                  tm->tm_hour = 0;
***************
*** 1234,1240 ****
                              case DTK_TODAY:
                                  tmask = DTK_DATE_M;
                                  *dtype = DTK_DATE;
!                                 GetCurrentTime(tm);
                                  tm->tm_hour = 0;
                                  tm->tm_min = 0;
                                  tm->tm_sec = 0;
--- 1234,1240 ----
                              case DTK_TODAY:
                                  tmask = DTK_DATE_M;
                                  *dtype = DTK_DATE;
!                                 GetCurrentDateTime(tm);
                                  tm->tm_hour = 0;
                                  tm->tm_min = 0;
                                  tm->tm_sec = 0;
***************
*** 1243,1249 ****
                              case DTK_TOMORROW:
                                  tmask = DTK_DATE_M;
                                  *dtype = DTK_DATE;
!                                 GetCurrentTime(tm);
                                  j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1),
                                  &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
                                  tm->tm_hour = 0;
--- 1243,1249 ----
                              case DTK_TOMORROW:
                                  tmask = DTK_DATE_M;
                                  *dtype = DTK_DATE;
!                                 GetCurrentDateTime(tm);
                                  j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1),
                                  &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
                                  tm->tm_hour = 0;
***************
*** 1319,1325 ****
                          ftype[i] = DTK_TZ;
                          break;

!                     case IGNORE:
                          break;

                      case AMPM:
--- 1319,1325 ----
                          ftype[i] = DTK_TZ;
                          break;

!                     case IGNORE_DTF:
                          break;

                      case AMPM:
***************
*** 1815,1821 ****
              case DTK_STRING:
              case DTK_SPECIAL:
                  type = DecodeSpecial(i, field[i], &val);
!                 if (type == IGNORE)
                      continue;

                  tmask = DTK_M(type);
--- 1815,1821 ----
              case DTK_STRING:
              case DTK_SPECIAL:
                  type = DecodeSpecial(i, field[i], &val);
!                 if (type == IGNORE_DTF)
                      continue;

                  tmask = DTK_M(type);
***************
*** 1885,1891 ****
                          ftype[i] = DTK_TZ;
                          break;

!                     case IGNORE:
                          break;

                      case AMPM:
--- 1885,1891 ----
                          ftype[i] = DTK_TZ;
                          break;

!                     case IGNORE_DTF:
                          break;

                      case AMPM:
***************
*** 1967,1973 ****

          if ((fmask & DTK_DATE_M) == 0)
          {
!             GetCurrentTime(tmp);
          }
          else
          {
--- 1967,1973 ----

          if ((fmask & DTK_DATE_M) == 0)
          {
!             GetCurrentDateTime(tmp);
          }
          else
          {
***************
*** 2043,2049 ****
          if (isalpha((unsigned char) *field[i]))
          {
              type = DecodeSpecial(i, field[i], &val);
!             if (type == IGNORE)
                  continue;

              dmask = DTK_M(type);
--- 2043,2049 ----
          if (isalpha((unsigned char) *field[i]))
          {
              type = DecodeSpecial(i, field[i], &val);
!             if (type == IGNORE_DTF)
                  continue;

              dmask = DTK_M(type);
***************
*** 2576,2582 ****

      *dtype = DTK_DELTA;

!     type = IGNORE;
      tm->tm_year = 0;
      tm->tm_mon = 0;
      tm->tm_mday = 0;
--- 2576,2582 ----

      *dtype = DTK_DELTA;

!     type = IGNORE_DTF;
      tm->tm_year = 0;
      tm->tm_mon = 0;
      tm->tm_mday = 0;
***************
*** 2633,2639 ****
                      tmask = DTK_M(TZ);
                      break;
                  }
!                 else if (type == IGNORE)
                  {
                      if (*cp == '.')
                      {
--- 2633,2639 ----
                      tmask = DTK_M(TZ);
                      break;
                  }
!                 else if (type == IGNORE_DTF)
                  {
                      if (*cp == '.')
                      {
***************
*** 2658,2664 ****
              case DTK_NUMBER:
                  val = strtol(field[i], &cp, 10);

!                 if (type == IGNORE)
                      type = DTK_SECOND;

                  if (*cp == '.')
--- 2658,2664 ----
              case DTK_NUMBER:
                  val = strtol(field[i], &cp, 10);

!                 if (type == IGNORE_DTF)
                      type = DTK_SECOND;

                  if (*cp == '.')
***************
*** 2826,2832 ****
              case DTK_STRING:
              case DTK_SPECIAL:
                  type = DecodeUnits(i, field[i], &val);
!                 if (type == IGNORE)
                      continue;

                  tmask = 0;        /* DTK_M(type); */
--- 2826,2832 ----
              case DTK_STRING:
              case DTK_SPECIAL:
                  type = DecodeUnits(i, field[i], &val);
!                 if (type == IGNORE_DTF)
                      continue;

                  tmask = 0;        /* DTK_M(type); */
Index: src/backend/utils/adt/nabstime.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v
retrieving revision 1.93
diff -c -r1.93 nabstime.c
*** src/backend/utils/adt/nabstime.c    2002/04/21 19:48:12    1.93
--- src/backend/utils/adt/nabstime.c    2002/06/10 17:44:31
***************
*** 239,252 ****


  void
! GetCurrentTime(struct tm * tm)
  {
      int            tz;

      abstime2tm(GetCurrentTransactionStartTime(), &tz, tm, NULL);

      return;
! }    /* GetCurrentTime() */


  void
--- 239,252 ----


  void
! GetCurrentDateTime(struct tm * tm)
  {
      int            tz;

      abstime2tm(GetCurrentTransactionStartTime(), &tz, tm, NULL);

      return;
! }    /* GetCurrentDateTime() */


  void
Index: src/backend/utils/adt/name.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/name.c,v
retrieving revision 1.35
diff -c -r1.35 name.c
*** src/backend/utils/adt/name.c    2002/05/17 20:53:33    1.35
--- src/backend/utils/adt/name.c    2002/06/10 17:44:31
***************
*** 219,231 ****
  Datum
  current_user(PG_FUNCTION_ARGS)
  {
!     PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserName(GetUserId()))));
  }

  Datum
  session_user(PG_FUNCTION_ARGS)
  {
!     PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserName(GetSessionUserId()))));
  }


--- 219,231 ----
  Datum
  current_user(PG_FUNCTION_ARGS)
  {
!     PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserNameFromId(GetUserId()))));
  }

  Datum
  session_user(PG_FUNCTION_ARGS)
  {
!     PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(GetUserNameFromId(GetSessionUserId()))));
  }


Index: src/backend/utils/init/miscinit.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/init/miscinit.c,v
retrieving revision 1.91
diff -c -r1.91 miscinit.c
*** src/backend/utils/init/miscinit.c    2002/05/17 01:19:18    1.91
--- src/backend/utils/init/miscinit.c    2002/06/10 17:44:31
***************
*** 676,682 ****
   * Get user name from user id
   */
  char *
! GetUserName(Oid userid)
  {
      HeapTuple    tuple;
      char       *result;
--- 676,682 ----
   * Get user name from user id
   */
  char *
! GetUserNameFromId(Oid userid)
  {
      HeapTuple    tuple;
      char       *result;
Index: src/backend/utils/init/postinit.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/init/postinit.c,v
retrieving revision 1.106
diff -c -r1.106 postinit.c
*** src/backend/utils/init/postinit.c    2002/05/20 23:51:43    1.106
--- src/backend/utils/init/postinit.c    2002/06/10 17:44:31
***************
*** 286,294 ****
       */

      /*
!      * Set up my per-backend PROC struct in shared memory.    (We need to
       * know MyDatabaseId before we can do this, since it's entered into
!      * the PROC struct.)
       */
      InitProcess();

--- 286,294 ----
       */

      /*
!      * Set up my per-backend PGPROC struct in shared memory.    (We need to
       * know MyDatabaseId before we can do this, since it's entered into
!      * the PGPROC struct.)
       */
      InitProcess();

Index: src/include/miscadmin.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/miscadmin.h,v
retrieving revision 1.104
diff -c -r1.104 miscadmin.h
*** src/include/miscadmin.h    2002/05/17 01:19:19    1.104
--- src/include/miscadmin.h    2002/06/10 17:44:31
***************
*** 203,209 ****
  extern void SetDatabaseName(const char *name);
  extern void SetDatabasePath(const char *path);

! extern char *GetUserName(Oid userid);

  extern Oid    GetUserId(void);
  extern void SetUserId(Oid userid);
--- 203,209 ----
  extern void SetDatabaseName(const char *name);
  extern void SetDatabasePath(const char *path);

! extern char *GetUserNameFromId(Oid userid);

  extern Oid    GetUserId(void);
  extern void SetUserId(Oid userid);
Index: src/include/storage/lock.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/lock.h,v
retrieving revision 1.59
diff -c -r1.59 lock.h
*** src/include/storage/lock.h    2001/11/05 17:46:35    1.59
--- src/include/storage/lock.h    2002/06/10 17:44:31
***************
*** 22,33 ****
  /* originally in procq.h */
  typedef struct PROC_QUEUE
  {
!     SHM_QUEUE    links;            /* head of list of PROC objects */
      int            size;            /* number of entries in list */
  } PROC_QUEUE;

! /* struct PROC is declared in storage/proc.h, but must forward-reference it */
! typedef struct PROC PROC;


  extern int    max_locks_per_xact;
--- 22,33 ----
  /* originally in procq.h */
  typedef struct PROC_QUEUE
  {
!     SHM_QUEUE    links;            /* head of list of PGPROC objects */
      int            size;            /* number of entries in list */
  } PROC_QUEUE;

! /* struct PGPROC is declared in storage/proc.h, but must forward-reference it */
! typedef struct PGPROC PGPROC;


  extern int    max_locks_per_xact;
***************
*** 161,167 ****
      int            grantMask;        /* bitmask for lock types already granted */
      int            waitMask;        /* bitmask for lock types awaited */
      SHM_QUEUE    lockHolders;    /* list of HOLDER objects assoc. with lock */
!     PROC_QUEUE    waitProcs;        /* list of PROC objects waiting on lock */
      int            requested[MAX_LOCKMODES];        /* counts of requested
                                                   * locks */
      int            nRequested;        /* total of requested[] array */
--- 161,167 ----
      int            grantMask;        /* bitmask for lock types already granted */
      int            waitMask;        /* bitmask for lock types awaited */
      SHM_QUEUE    lockHolders;    /* list of HOLDER objects assoc. with lock */
!     PROC_QUEUE    waitProcs;        /* list of PGPROC objects waiting on lock */
      int            requested[MAX_LOCKMODES];        /* counts of requested
                                                   * locks */
      int            nRequested;        /* total of requested[] array */
***************
*** 181,188 ****
   * holder hashtable.  A HOLDERTAG value uniquely identifies a lock holder.
   *
   * There are two possible kinds of holder tags: a transaction (identified
!  * both by the PROC of the backend running it, and the xact's own ID) and
!  * a session (identified by backend PROC, with xid = InvalidTransactionId).
   *
   * Currently, session holders are used for user locks and for cross-xact
   * locks obtained for VACUUM.  We assume that a session lock never conflicts
--- 181,188 ----
   * holder hashtable.  A HOLDERTAG value uniquely identifies a lock holder.
   *
   * There are two possible kinds of holder tags: a transaction (identified
!  * both by the PGPROC of the backend running it, and the xact's own ID) and
!  * a session (identified by backend PGPROC, with xid = InvalidTransactionId).
   *
   * Currently, session holders are used for user locks and for cross-xact
   * locks obtained for VACUUM.  We assume that a session lock never conflicts
***************
*** 195,209 ****
   * as soon as convenient.
   *
   * Each HOLDER object is linked into lists for both the associated LOCK object
!  * and the owning PROC object.    Note that the HOLDER is entered into these
   * 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
   * the lock's waitProcs queue.
   */
  typedef struct HOLDERTAG
  {
      SHMEM_OFFSET lock;            /* link to per-lockable-object information */
!     SHMEM_OFFSET proc;            /* link to PROC of owning backend */
      TransactionId xid;            /* xact ID, or InvalidTransactionId */
  } HOLDERTAG;

--- 195,209 ----
   * as soon as convenient.
   *
   * Each HOLDER object is linked into lists for both the associated LOCK object
!  * and the owning PGPROC object.    Note that the HOLDER is entered into these
   * lists as soon as it is created, even if no lock has yet been granted.
!  * A PGPROC that is waiting for a lock to be granted will also be linked into
   * the lock's waitProcs queue.
   */
  typedef struct HOLDERTAG
  {
      SHMEM_OFFSET lock;            /* link to per-lockable-object information */
!     SHMEM_OFFSET proc;            /* link to PGPROC of owning backend */
      TransactionId xid;            /* xact ID, or InvalidTransactionId */
  } HOLDERTAG;

***************
*** 235,250 ****
              TransactionId xid, LOCKMODE lockmode, bool dontWait);
  extern bool LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
              TransactionId xid, LOCKMODE lockmode);
! extern bool LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc,
                 bool allxids, TransactionId xid);
  extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
                     LOCKMODE lockmode,
!                    LOCK *lock, HOLDER *holder, PROC *proc,
                     int *myHolding);
  extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode);
! extern void RemoveFromWaitQueue(PROC *proc);
  extern int    LockShmemSize(int maxBackends);
! extern bool DeadLockCheck(PROC *proc);
  extern void InitDeadLockChecking(void);

  #ifdef LOCK_DEBUG
--- 235,250 ----
              TransactionId xid, LOCKMODE lockmode, bool dontWait);
  extern bool LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
              TransactionId xid, LOCKMODE lockmode);
! extern bool LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
                 bool allxids, TransactionId xid);
  extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
                     LOCKMODE lockmode,
!                    LOCK *lock, HOLDER *holder, PGPROC *proc,
                     int *myHolding);
  extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode);
! extern void RemoveFromWaitQueue(PGPROC *proc);
  extern int    LockShmemSize(int maxBackends);
! extern bool DeadLockCheck(PGPROC *proc);
  extern void InitDeadLockChecking(void);

  #ifdef LOCK_DEBUG
Index: src/include/storage/proc.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/proc.h,v
retrieving revision 1.55
diff -c -r1.55 proc.h
*** src/include/storage/proc.h    2002/05/05 00:03:29    1.55
--- src/include/storage/proc.h    2002/06/10 17:44:31
***************
*** 21,34 ****


  /*
!  * Each backend has a PROC struct in shared memory.  There is also a list of
!  * currently-unused PROC structs that will be reallocated to new backends.
   *
!  * links: list link for any list the PROC is in.  When waiting for a lock,
!  * the PROC is linked into that lock's waitProcs queue.  A recycled PROC
   * is linked into ProcGlobal's freeProcs list.
   */
! struct PROC
  {
      /* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */
      SHM_QUEUE    links;            /* list link if process is in a list */
--- 21,34 ----


  /*
!  * Each backend has a PGPROC struct in shared memory.  There is also a list of
!  * currently-unused PGPROC structs that will be reallocated to new backends.
   *
!  * links: list link for any list the PGPROC is in.  When waiting for a lock,
!  * the PGPROC is linked into that lock's waitProcs queue.  A recycled PGPROC
   * is linked into ProcGlobal's freeProcs list.
   */
! struct PGPROC
  {
      /* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */
      SHM_QUEUE    links;            /* list link if process is in a list */
***************
*** 56,62 ****
      /* Info about LWLock the process is currently waiting for, if any. */
      bool        lwWaiting;        /* true if waiting for an LW lock */
      bool        lwExclusive;    /* true if waiting for exclusive access */
!     struct PROC *lwWaitLink;    /* next waiter for same LW lock */

      /* Info about lock the process is currently waiting for, if any. */
      /* waitLock and waitHolder are NULL if not currently waiting. */
--- 56,62 ----
      /* Info about LWLock the process is currently waiting for, if any. */
      bool        lwWaiting;        /* true if waiting for an LW lock */
      bool        lwExclusive;    /* true if waiting for exclusive access */
!     struct PGPROC *lwWaitLink;    /* next waiter for same LW lock */

      /* Info about lock the process is currently waiting for, if any. */
      /* waitLock and waitHolder are NULL if not currently waiting. */
***************
*** 70,79 ****
                                   * or awaited by this backend */
  };

! /* NOTE: "typedef struct PROC PROC" appears in storage/lock.h. */


! extern PROC *MyProc;


  /*
--- 70,79 ----
                                   * or awaited by this backend */
  };

! /* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */


! extern PGPROC *MyProc;


  /*
***************
*** 81,87 ****
   */
  typedef struct PROC_HDR
  {
!     /* Head of list of free PROC structures */
      SHMEM_OFFSET freeProcs;
  } PROC_HDR;

--- 81,87 ----
   */
  typedef struct PROC_HDR
  {
!     /* Head of list of free PGPROC structures */
      SHMEM_OFFSET freeProcs;
  } PROC_HDR;

***************
*** 102,108 ****
  extern void ProcQueueInit(PROC_QUEUE *queue);
  extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode,
            LOCK *lock, HOLDER *holder);
! extern PROC *ProcWakeup(PROC *proc, int errType);
  extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock);
  extern bool LockWaitCancel(void);
  extern void HandleDeadLock(SIGNAL_ARGS);
--- 102,108 ----
  extern void ProcQueueInit(PROC_QUEUE *queue);
  extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode,
            LOCK *lock, HOLDER *holder);
! extern PGPROC *ProcWakeup(PGPROC *proc, int errType);
  extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock);
  extern bool LockWaitCancel(void);
  extern void HandleDeadLock(SIGNAL_ARGS);
Index: src/include/storage/sinval.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/sinval.h,v
retrieving revision 1.26
diff -c -r1.26 sinval.h
*** src/include/storage/sinval.h    2002/03/03 17:47:56    1.26
--- src/include/storage/sinval.h    2002/06/10 17:44:31
***************
*** 86,92 ****
  extern TransactionId GetOldestXmin(bool allDbs);
  extern int    CountActiveBackends(void);

! /* Use "struct PROC", not PROC, to avoid including proc.h here */
! extern struct PROC *BackendIdGetProc(BackendId procId);

  #endif   /* SINVAL_H */
--- 86,92 ----
  extern TransactionId GetOldestXmin(bool allDbs);
  extern int    CountActiveBackends(void);

! /* Use "struct PGPROC", not PGPROC, to avoid including proc.h here */
! extern struct PGPROC *BackendIdGetProc(BackendId procId);

  #endif   /* SINVAL_H */
Index: src/include/storage/sinvaladt.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/sinvaladt.h,v
retrieving revision 1.30
diff -c -r1.30 sinvaladt.h
*** src/include/storage/sinvaladt.h    2001/11/05 17:46:35    1.30
--- src/include/storage/sinvaladt.h    2002/06/10 17:44:31
***************
*** 71,77 ****
      /* nextMsgNum is -1 in an inactive ProcState array entry. */
      int            nextMsgNum;        /* next message number to read, or -1 */
      bool        resetState;        /* true, if backend has to reset its state */
!     SHMEM_OFFSET procStruct;    /* location of backend's PROC struct */
  } ProcState;

  /* Shared cache invalidation memory segment */
--- 71,77 ----
      /* nextMsgNum is -1 in an inactive ProcState array entry. */
      int            nextMsgNum;        /* next message number to read, or -1 */
      bool        resetState;        /* true, if backend has to reset its state */
!     SHMEM_OFFSET procStruct;    /* location of backend's PGPROC struct */
  } ProcState;

  /* Shared cache invalidation memory segment */
Index: src/include/utils/datetime.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/utils/datetime.h,v
retrieving revision 1.30
diff -c -r1.30 datetime.h
*** src/include/utils/datetime.h    2002/05/17 01:19:19    1.30
--- src/include/utils/datetime.h    2002/06/10 17:44:31
***************
*** 95,101 ****
  #define TZ        5
  #define DTZ        6
  #define DTZMOD    7
! #define IGNORE    8
  #define AMPM    9
  #define HOUR    10
  #define MINUTE    11
--- 95,101 ----
  #define TZ        5
  #define DTZ        6
  #define DTZMOD    7
! #define IGNORE_DTF    8
  #define AMPM    9
  #define HOUR    10
  #define MINUTE    11
***************
*** 260,266 ****
    || (((m) == UTIME_MAXMONTH) && ((d) <= UTIME_MAXDAY))))))


! extern void GetCurrentTime(struct tm * tm);
  extern void GetCurrentTimeUsec(struct tm * tm, fsec_t *fsec);
  extern void j2date(int jd, int *year, int *month, int *day);
  extern int    date2j(int year, int month, int day);
--- 260,266 ----
    || (((m) == UTIME_MAXMONTH) && ((d) <= UTIME_MAXDAY))))))


! extern void GetCurrentDateTime(struct tm * tm);
  extern void GetCurrentTimeUsec(struct tm * tm, fsec_t *fsec);
  extern void j2date(int jd, int *year, int *month, int *day);
  extern int    date2j(int year, int month, int day);
Index: src/include/utils/exc.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/utils/exc.h,v
retrieving revision 1.22
diff -c -r1.22 exc.h
*** src/include/utils/exc.h    2001/11/05 17:46:36    1.22
--- src/include/utils/exc.h    2002/06/10 17:44:31
***************
*** 40,46 ****
  /* These are not used anywhere 1998/6/15 */
  #define ExcBegin() \
  do { \
!     ExcFrame        exception;�\
      \
      exception.link = ExcCurFrameP; \
      if (sigsetjmp(exception.context, 1) == 0) \
--- 40,46 ----
  /* These are not used anywhere 1998/6/15 */
  #define ExcBegin() \
  do { \
!     ExcFrame    exception; \
      \
      exception.link = ExcCurFrameP; \
      if (sigsetjmp(exception.context, 1) == 0) \
Index: src/interfaces/ecpg/preproc/c_keywords.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/preproc/c_keywords.c,v
retrieving revision 1.12
diff -c -r1.12 c_keywords.c
*** src/interfaces/ecpg/preproc/c_keywords.c    2002/05/20 09:29:41    1.12
--- src/interfaces/ecpg/preproc/c_keywords.c    2002/06/10 17:44:31
***************
*** 23,34 ****
      {"VARCHAR", VARCHAR},
      {"auto", S_AUTO},
      {"bool", SQL_BOOL},
!     {"char", CHAR},
      {"const", S_CONST},
      {"double", DOUBLE},
      {"enum", SQL_ENUM},
      {"extern", S_EXTERN},
!     {"float", FLOAT},
      {"int", INT},
      {"long", SQL_LONG},
      {"register", S_REGISTER},
--- 23,34 ----
      {"VARCHAR", VARCHAR},
      {"auto", S_AUTO},
      {"bool", SQL_BOOL},
!     {"char", CHAR_P},
      {"const", S_CONST},
      {"double", DOUBLE},
      {"enum", SQL_ENUM},
      {"extern", S_EXTERN},
!     {"float", FLOAT_P},
      {"int", INT},
      {"long", SQL_LONG},
      {"register", S_REGISTER},
Index: src/interfaces/ecpg/preproc/keywords.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v
retrieving revision 1.48
diff -c -r1.48 keywords.c
*** src/interfaces/ecpg/preproc/keywords.c    2002/05/19 20:00:53    1.48
--- src/interfaces/ecpg/preproc/keywords.c    2002/06/10 17:44:31
***************
*** 62,68 ****
      {"case", CASE},
      {"cast", CAST},
      {"chain", CHAIN},
!     {"char", CHAR},
      {"character", CHARACTER},
      {"characteristics", CHARACTERISTICS},
      {"check", CHECK},
--- 62,68 ----
      {"case", CASE},
      {"cast", CAST},
      {"chain", CHAIN},
!     {"char", CHAR_P},
      {"character", CHARACTER},
      {"characteristics", CHARACTERISTICS},
      {"check", CHECK},
***************
*** 97,103 ****
      {"deferrable", DEFERRABLE},
      {"deferred", DEFERRED},
      {"definer", DEFINER},
!     {"delete", DELETE},
      {"delimiters", DELIMITERS},
      {"desc", DESC},
      {"distinct", DISTINCT},
--- 97,103 ----
      {"deferrable", DEFERRABLE},
      {"deferred", DEFERRED},
      {"definer", DEFINER},
!     {"delete", DELETE_P},
      {"delimiters", DELIMITERS},
      {"desc", DESC},
      {"distinct", DISTINCT},
***************
*** 120,126 ****
      {"extract", EXTRACT},
      {"false", FALSE_P},
      {"fetch", FETCH},
!     {"float", FLOAT},
      {"for", FOR},
      {"force", FORCE},
      {"foreign", FOREIGN},
--- 120,126 ----
      {"extract", EXTRACT},
      {"false", FALSE_P},
      {"fetch", FETCH},
!     {"float", FLOAT_P},
      {"for", FOR},
      {"force", FORCE},
      {"foreign", FOREIGN},
***************
*** 131,137 ****
      {"function", FUNCTION},
      {"global", GLOBAL},
      {"grant", GRANT},
!     {"group", GROUP},
      {"handler", HANDLER},
      {"having", HAVING},
      {"hour", HOUR_P},
--- 131,137 ----
      {"function", FUNCTION},
      {"global", GLOBAL},
      {"grant", GRANT},
!     {"group", GROUP_P},
      {"handler", HANDLER},
      {"having", HAVING},
      {"hour", HOUR_P},
***************
*** 139,145 ****
      {"immediate", IMMEDIATE},
      {"immutable", IMMUTABLE},
      {"implicit", IMPLICIT},
!     {"in", IN},
      {"increment", INCREMENT},
      {"index", INDEX},
      {"inherits", INHERITS},
--- 139,145 ----
      {"immediate", IMMEDIATE},
      {"immutable", IMMUTABLE},
      {"implicit", IMPLICIT},
!     {"in", IN_P},
      {"increment", INCREMENT},
      {"index", INDEX},
      {"inherits", INHERITS},
***************
*** 208,214 ****
      {"option", OPTION},
      {"or", OR},
      {"order", ORDER},
!     {"out", OUT},
      {"outer", OUTER_P},
      {"overlaps", OVERLAPS},
      {"owner", OWNER},
--- 208,214 ----
      {"option", OPTION},
      {"or", OR},
      {"order", ORDER},
!     {"out", OUT_P},
      {"outer", OUTER_P},
      {"overlaps", OVERLAPS},
      {"owner", OWNER},
Index: src/interfaces/ecpg/preproc/preproc.y
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.189
diff -c -r1.189 preproc.y
*** src/interfaces/ecpg/preproc/preproc.y    2002/05/20 09:29:41    1.189
--- src/interfaces/ecpg/preproc/preproc.y    2002/06/10 17:44:32
***************
*** 184,207 ****
          BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
          BOOLEAN, BY,

!         CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR, CHARACTER,
          CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE,
          COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY,
          CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME,
          CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,

          DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED,
!         DEFINER, DELETE, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP,
          EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE,
          EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT,

!         FALSE_P, FETCH, FLOAT, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM,
          FULL, FUNCTION,

!     GLOBAL, GRANT, GROUP,
          HANDLER, HAVING, HOUR_P,

!     ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN, INCREMENT, INDEX, INHERITS,
          INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT,
          INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION,

--- 184,207 ----
          BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
          BOOLEAN, BY,

!         CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR_P, CHARACTER,
          CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE,
          COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY,
          CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME,
          CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,

          DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED,
!         DEFINER, DELETE_P, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP,
          EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE,
          EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT,

!         FALSE_P, FETCH, FLOAT_P, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM,
          FULL, FUNCTION,

!     GLOBAL, GRANT, GROUP_P,
          HANDLER, HAVING, HOUR_P,

!     ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN_P, INCREMENT, INDEX, INHERITS,
          INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT,
          INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION,

***************
*** 218,224 ****
          NUMERIC,

      OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER,
!         OUT, OUTER_P, OVERLAPS, OWNER,

      PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY,
      PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL,
--- 218,224 ----
          NUMERIC,

      OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER,
!         OUT_P, OUTER_P, OVERLAPS, OWNER,

      PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY,
      PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL,
***************
*** 268,274 ****
  %nonassoc    ESCAPE
  %nonassoc    OVERLAPS
  %nonassoc    BETWEEN
! %nonassoc    IN
  %left            POSTFIXOP                    /* dummy for postfix Op rules */
  %left        Op                /* multi-character ops and user-defined operators */
  %nonassoc    NOTNULL
--- 268,274 ----
  %nonassoc    ESCAPE
  %nonassoc    OVERLAPS
  %nonassoc    BETWEEN
! %nonassoc    IN_P
  %left            POSTFIXOP                    /* dummy for postfix Op rules */
  %left        Op                /* multi-character ops and user-defined operators */
  %nonassoc    NOTNULL
***************
*** 713,719 ****
              { $$ = make_str("createuser"); }
          | NOCREATEUSER
              { $$ = make_str("nocreateuser"); }
!         | IN GROUP user_list
              { $$ = cat2_str(make_str("in group"), $3); }
          | VALID UNTIL Sconst
              { $$ = cat2_str(make_str("valid until"), $3); }
--- 713,719 ----
              { $$ = make_str("createuser"); }
          | NOCREATEUSER
              { $$ = make_str("nocreateuser"); }
!         | IN_P GROUP_P user_list
              { $$ = cat2_str(make_str("in group"), $3); }
          | VALID UNTIL Sconst
              { $$ = cat2_str(make_str("valid until"), $3); }
***************
*** 731,739 ****
   *
   *
   ****************************************************************************/
! CreateGroupStmt:  CREATE GROUP UserId OptGroupList
              { $$ = cat_str(3, make_str("create group"), $3, $4); }
!         | CREATE GROUP UserId WITH OptGroupList
              { $$ = cat_str(4, make_str("create group"), $3, make_str("with"), $5); }
          ;

--- 731,739 ----
   *
   *
   ****************************************************************************/
! CreateGroupStmt:  CREATE GROUP_P UserId OptGroupList
              { $$ = cat_str(3, make_str("create group"), $3, $4); }
!         | CREATE GROUP_P UserId WITH OptGroupList
              { $$ = cat_str(4, make_str("create group"), $3, make_str("with"), $5); }
          ;

***************
*** 757,765 ****
   *
   *
   *****************************************************************************/
! AlterGroupStmt: ALTER GROUP UserId ADD USER user_list
              { $$ = cat_str(4, make_str("alter group"), $3, make_str("add user"), $6); }
!         | ALTER GROUP UserId DROP USER user_list
              { $$ = cat_str(4, make_str("alter group"), $3, make_str("drop user"), $6); }
          ;

--- 757,765 ----
   *
   *
   *****************************************************************************/
! AlterGroupStmt: ALTER GROUP_P UserId ADD USER user_list
              { $$ = cat_str(4, make_str("alter group"), $3, make_str("add user"), $6); }
!         | ALTER GROUP_P UserId DROP USER user_list
              { $$ = cat_str(4, make_str("alter group"), $3, make_str("drop user"), $6); }
          ;

***************
*** 769,775 ****
   *
   *
   *****************************************************************************/
! DropGroupStmt: DROP GROUP UserId
              { $$ = cat2_str(make_str("drop group"), $3); }
          ;

--- 769,775 ----
   *
   *
   *****************************************************************************/
! DropGroupStmt: DROP GROUP_P UserId
              { $$ = cat2_str(make_str("drop group"), $3); }
          ;

***************
*** 1234,1240 ****
          | /*EMPTY*/                    { $$ = EMPTY; }
          ;

! key_delete: ON DELETE key_reference
              { $$ = cat2_str(make_str("on delete"), $3); }
          ;

--- 1234,1240 ----
          | /*EMPTY*/                    { $$ = EMPTY; }
          ;

! key_delete: ON DELETE_P key_reference
              { $$ = cat2_str(make_str("on delete"), $3); }
          ;

***************
*** 1396,1402 ****
          ;

  TriggerOneEvent:  INSERT    { $$ = make_str("insert"); }
!         | DELETE            { $$ = make_str("delete"); }
          | UPDATE            { $$ = make_str("update"); }
          ;

--- 1396,1402 ----
          ;

  TriggerOneEvent:  INSERT    { $$ = make_str("insert"); }
!         | DELETE_P            { $$ = make_str("delete"); }
          | UPDATE            { $$ = make_str("update"); }
          ;

***************
*** 1611,1617 ****
          | PRIOR                { $$ = make_str("prior"); }
          ;

! from_in: IN                    { $$ = make_str("in"); }
          | FROM                { $$ = make_str("from"); }
          ;

--- 1611,1617 ----
          | PRIOR                { $$ = make_str("prior"); }
          ;

! from_in: IN_P                { $$ = make_str("in"); }
          | FROM                { $$ = make_str("from"); }
          ;

***************
*** 1687,1693 ****
  privilege:    SELECT            { $$ = make_str("select"); }
          | INSERT            { $$ = make_str("insert"); }
          | UPDATE            { $$ = make_str("update"); }
!         | DELETE            { $$ = make_str("delete"); }
          | RULE                { $$ = make_str("rule"); }
          | REFERENCES        { $$ = make_str("references"); }
          | TRIGGER            { $$ = make_str("trigger"); }
--- 1687,1693 ----
  privilege:    SELECT            { $$ = make_str("select"); }
          | INSERT            { $$ = make_str("insert"); }
          | UPDATE            { $$ = make_str("update"); }
!         | DELETE_P            { $$ = make_str("delete"); }
          | RULE                { $$ = make_str("rule"); }
          | REFERENCES        { $$ = make_str("references"); }
          | TRIGGER            { $$ = make_str("trigger"); }
***************
*** 1719,1725 ****
          ;

  grantee:  ColId            { $$ = $1; }
!         | GROUP ColId        { $$ = cat2_str(make_str("group"), $2); }
          ;

  opt_grant_grant_option:  WITH GRANT OPTION
--- 1719,1725 ----
          ;

  grantee:  ColId            { $$ = $1; }
!         | GROUP_P ColId        { $$ = cat2_str(make_str("group"), $2); }
          ;

  opt_grant_grant_option:  WITH GRANT OPTION
***************
*** 1854,1861 ****
          | func_type        { $$ = $1; }
          ;

! opt_arg:  IN    { $$ = make_str("in"); }
!         | OUT
          {
              mmerror(PARSE_ERROR, ET_WARNING, "Currently unsupported CREATE FUNCTION/OUT will be passed to backend");

--- 1854,1861 ----
          | func_type        { $$ = $1; }
          ;

! opt_arg:  IN_P    { $$ = make_str("in"); }
!         | OUT_P
          {
              mmerror(PARSE_ERROR, ET_WARNING, "Currently unsupported CREATE FUNCTION/OUT will be passed to backend");

***************
*** 2049,2055 ****
  /* change me to select, update, etc. some day */
  event:    SELECT                { $$ = make_str("select"); }
          | UPDATE            { $$ = make_str("update"); }
!         | DELETE            { $$ = make_str("delete"); }
          | INSERT            { $$ = make_str("insert"); }
           ;

--- 2049,2055 ----
  /* change me to select, update, etc. some day */
  event:    SELECT                { $$ = make_str("select"); }
          | UPDATE            { $$ = make_str("update"); }
!         | DELETE_P            { $$ = make_str("delete"); }
          | INSERT            { $$ = make_str("insert"); }
           ;

***************
*** 2354,2360 ****
   *
   *****************************************************************************/

! DeleteStmt:  DELETE FROM relation_expr where_clause
              { $$ = cat_str(3, make_str("delete from"), $3, $4); }
          ;

--- 2354,2360 ----
   *
   *****************************************************************************/

! DeleteStmt:  DELETE_P FROM relation_expr where_clause
              { $$ = cat_str(3, make_str("delete from"), $3, $4); }
          ;

***************
*** 2362,2368 ****
              { $$ = cat_str(4, make_str("lock"), $2, $3, $4); }
          ;

! opt_lock:  IN lock_type MODE
              { $$ = cat_str(3, make_str("in"), $2, make_str("mode")); }
          | /*EMPTY*/
              { $$ = EMPTY;}
--- 2362,2368 ----
              { $$ = cat_str(4, make_str("lock"), $2, $3, $4); }
          ;

! opt_lock:  IN_P lock_type MODE
              { $$ = cat_str(3, make_str("in"), $2, make_str("mode")); }
          | /*EMPTY*/
              { $$ = EMPTY;}
***************
*** 2600,2606 ****
   *    ...however, recursive addattr and rename supported.  make special
   *    cases for these.
   */
! group_clause:  GROUP BY expr_list
              { $$ = cat2_str(make_str("group by"), $3); }
          | /*EMPTY*/
              { $$ = EMPTY; }
--- 2600,2606 ----
   *    ...however, recursive addattr and rename supported.  make special
   *    cases for these.
   */
! group_clause:  GROUP_P BY expr_list
              { $$ = cat2_str(make_str("group by"), $3); }
          | /*EMPTY*/
              { $$ = EMPTY; }
***************
*** 2837,2843 ****
              { $$ = make_str("bigint"); }
          | REAL
              { $$ = make_str("real"); }
!         | FLOAT opt_float
              { $$ = cat2_str(make_str("float"), $2); }
          | DOUBLE PRECISION
              { $$ = make_str("double precision"); }
--- 2837,2843 ----
              { $$ = make_str("bigint"); }
          | REAL
              { $$ = make_str("real"); }
!         | FLOAT_P opt_float
              { $$ = cat2_str(make_str("float"), $2); }
          | DOUBLE PRECISION
              { $$ = make_str("double precision"); }
***************
*** 2896,2908 ****

  character:    CHARACTER opt_varying
              { $$ = cat2_str(make_str("character"), $2); }
!         | CHAR opt_varying
              { $$ = cat2_str(make_str("char"), $2); }
          | VARCHAR
              { $$ = make_str("varchar"); }
          | NATIONAL CHARACTER opt_varying
              { $$ = cat2_str(make_str("national character"), $3); }
!         | NATIONAL CHAR opt_varying
              { $$ = cat2_str(make_str("national char"), $3); }
          | NCHAR opt_varying
              { $$ = cat2_str(make_str("nchar"), $2); }
--- 2896,2908 ----

  character:    CHARACTER opt_varying
              { $$ = cat2_str(make_str("character"), $2); }
!         | CHAR_P opt_varying
              { $$ = cat2_str(make_str("char"), $2); }
          | VARCHAR
              { $$ = make_str("varchar"); }
          | NATIONAL CHARACTER opt_varying
              { $$ = cat2_str(make_str("national character"), $3); }
!         | NATIONAL CHAR_P opt_varying
              { $$ = cat2_str(make_str("national char"), $3); }
          | NCHAR opt_varying
              { $$ = cat2_str(make_str("nchar"), $2); }
***************
*** 2975,2983 ****
   * Define row_descriptor to allow yacc to break the reduce/reduce conflict
   *    with singleton expressions.
   */
! row_expr: '(' row_descriptor ')' IN select_with_parens
              { $$ = cat_str(4, make_str("("), $2, make_str(") in "), $5); }
!         | '(' row_descriptor ')' NOT IN select_with_parens
              { $$ = cat_str(4, make_str("("), $2, make_str(") not in "), $6); }
          | '(' row_descriptor ')' all_Op sub_type select_with_parens
              { $$ = cat_str(6, make_str("("), $2, make_str(")"), $4, $5, $6); }
--- 2975,2983 ----
   * Define row_descriptor to allow yacc to break the reduce/reduce conflict
   *    with singleton expressions.
   */
! row_expr: '(' row_descriptor ')' IN_P select_with_parens
              { $$ = cat_str(4, make_str("("), $2, make_str(") in "), $5); }
!         | '(' row_descriptor ')' NOT IN_P select_with_parens
              { $$ = cat_str(4, make_str("("), $2, make_str(") not in "), $6); }
          | '(' row_descriptor ')' all_Op sub_type select_with_parens
              { $$ = cat_str(6, make_str("("), $2, make_str(")"), $4, $5, $6); }
***************
*** 3140,3148 ****
              { $$ = cat_str(5, $1, make_str("between"), $3, make_str("and"), $5); }
          | a_expr NOT BETWEEN b_expr AND b_expr    %prec BETWEEN
              { $$ = cat_str(5, $1, make_str("not between"), $4, make_str("and"), $6); }
!         | a_expr IN in_expr
              { $$ = cat_str(3, $1, make_str(" in"), $3); }
!         | a_expr NOT IN in_expr
              { $$ = cat_str(3, $1, make_str(" not in "), $4); }
          | a_expr all_Op sub_type select_with_parens %prec Op
              { $$ = cat_str(4, $1, $2, $3, $4); }
--- 3140,3148 ----
              { $$ = cat_str(5, $1, make_str("between"), $3, make_str("and"), $5); }
          | a_expr NOT BETWEEN b_expr AND b_expr    %prec BETWEEN
              { $$ = cat_str(5, $1, make_str("not between"), $4, make_str("and"), $6); }
!         | a_expr IN_P in_expr
              { $$ = cat_str(3, $1, make_str(" in"), $3); }
!         | a_expr NOT IN_P in_expr
              { $$ = cat_str(3, $1, make_str(" not in "), $4); }
          | a_expr all_Op sub_type select_with_parens %prec Op
              { $$ = cat_str(4, $1, $2, $3, $4); }
***************
*** 3307,3313 ****
          ;

  /* position_list uses b_expr not a_expr to avoid conflict with general IN */
! position_list:    b_expr IN b_expr
              { $$ = cat_str(3, $1, make_str("in"), $3); }
          | /* EMPTY */
              { $$ = EMPTY; }
--- 3307,3313 ----
          ;

  /* position_list uses b_expr not a_expr to avoid conflict with general IN */
! position_list:    b_expr IN_P b_expr
              { $$ = cat_str(3, $1, make_str("in"), $3); }
          | /* EMPTY */
              { $$ = EMPTY; }
***************
*** 4146,4152 ****
              $$ = ECPGt_unsigned_long;
  #endif
          }
!         | SQL_UNSIGNED CHAR            { $$ = ECPGt_unsigned_char; }
          ;

  signed_type: SQL_SHORT                { $$ = ECPGt_short; }
--- 4146,4152 ----
              $$ = ECPGt_unsigned_long;
  #endif
          }
!         | SQL_UNSIGNED CHAR_P            { $$ = ECPGt_unsigned_char; }
          ;

  signed_type: SQL_SHORT                { $$ = ECPGt_short; }
***************
*** 4171,4177 ****
  #endif
          }
          | SQL_BOOL                    { $$ = ECPGt_bool; }
!         | CHAR                        { $$ = ECPGt_char; }
          ;

  opt_signed: SQL_SIGNED
--- 4171,4177 ----
  #endif
          }
          | SQL_BOOL                    { $$ = ECPGt_bool; }
!         | CHAR_P                    { $$ = ECPGt_char; }
          ;

  opt_signed: SQL_SIGNED
***************
*** 4823,4829 ****
          | unreserved_keyword            { $$ = $1; }
          | col_name_keyword                { $$ = $1; }
          | ECPGKeywords                    { $$ = $1; }
!         | CHAR                            { $$ = make_str("char"); }
          ;

  /* Type identifier --- names that can be type names.
--- 4823,4829 ----
          | unreserved_keyword            { $$ = $1; }
          | col_name_keyword                { $$ = $1; }
          | ECPGKeywords                    { $$ = $1; }
!         | CHAR_P                        { $$ = make_str("char"); }
          ;

  /* Type identifier --- names that can be type names.
***************
*** 4847,4853 ****
   */
  ColLabel:  ECPGColLabel                    { $$ = $1; }
          | ECPGTypeName                    { $$ = $1; }
!         | CHAR                            { $$ = make_str("char"); }
          | INT                            { $$ = make_str("int"); }
          | UNION                            { $$ = make_str("union"); }
          ;
--- 4847,4853 ----
   */
  ColLabel:  ECPGColLabel                    { $$ = $1; }
          | ECPGTypeName                    { $$ = $1; }
!         | CHAR_P                        { $$ = make_str("char"); }
          | INT                            { $$ = make_str("int"); }
          | UNION                            { $$ = make_str("union"); }
          ;
***************
*** 4907,4913 ****
          | DAY_P                            { $$ = make_str("day"); }
          | DECLARE                        { $$ = make_str("declare"); }
          | DEFERRED                        { $$ = make_str("deferred"); }
!         | DELETE                        { $$ = make_str("delete"); }
          | DELIMITERS                    { $$ = make_str("delimiters"); }
          | DOMAIN_P                    { $$ = make_str("domain"); }
          | DOUBLE                        { $$ = make_str("double"); }
--- 4907,4913 ----
          | DAY_P                            { $$ = make_str("day"); }
          | DECLARE                        { $$ = make_str("declare"); }
          | DEFERRED                        { $$ = make_str("deferred"); }
!         | DELETE_P                        { $$ = make_str("delete"); }
          | DELIMITERS                    { $$ = make_str("delimiters"); }
          | DOMAIN_P                    { $$ = make_str("domain"); }
          | DOUBLE                        { $$ = make_str("double"); }
***************
*** 4963,4969 ****
          | OIDS                            { $$ = make_str("oids"); }
          | OPERATOR                        { $$ = make_str("operator"); }
          | OPTION                        { $$ = make_str("option"); }
!         | OUT                            { $$ = make_str("out"); }
          | OWNER                            { $$ = make_str("owner"); }
          | PARTIAL                        { $$ = make_str("partial"); }
          | PASSWORD                        { $$ = make_str("password"); }
--- 4963,4969 ----
          | OIDS                            { $$ = make_str("oids"); }
          | OPERATOR                        { $$ = make_str("operator"); }
          | OPTION                        { $$ = make_str("option"); }
!         | OUT_P                            { $$ = make_str("out"); }
          | OWNER                            { $$ = make_str("owner"); }
          | PARTIAL                        { $$ = make_str("partial"); }
          | PASSWORD                        { $$ = make_str("password"); }
***************
*** 5044,5050 ****
          BIGINT            { $$ = make_str("bigint");}
          | BIT            { $$ = make_str("bit"); }
  /* CHAR must be excluded from ECPGColLabel because of conflict with UNSIGNED
!         | CHAR            { $$ = make_str("char"); }
   */
          | CHARACTER        { $$ = make_str("character"); }
          | COALESCE        { $$ = make_str("coalesce"); }
--- 5044,5050 ----
          BIGINT            { $$ = make_str("bigint");}
          | BIT            { $$ = make_str("bit"); }
  /* CHAR must be excluded from ECPGColLabel because of conflict with UNSIGNED
!         | CHAR_P        { $$ = make_str("char"); }
   */
          | CHARACTER        { $$ = make_str("character"); }
          | COALESCE        { $$ = make_str("coalesce"); }
***************
*** 5052,5058 ****
          | DECIMAL        { $$ = make_str("decimal"); }
          | EXISTS        { $$ = make_str("exists"); }
          | EXTRACT        { $$ = make_str("extract"); }
!         | FLOAT            { $$ = make_str("float"); }
  /* INT must be excluded from ECPGColLabel because of conflict
          | INT            { $$ = make_str("int"); }
   */
--- 5052,5058 ----
          | DECIMAL        { $$ = make_str("decimal"); }
          | EXISTS        { $$ = make_str("exists"); }
          | EXTRACT        { $$ = make_str("extract"); }
!         | FLOAT_P        { $$ = make_str("float"); }
  /* INT must be excluded from ECPGColLabel because of conflict
          | INT            { $$ = make_str("int"); }
   */
***************
*** 5091,5097 ****
          | FREEZE                        { $$ = make_str("freeze"); }
          | FULL                            { $$ = make_str("full"); }
          | ILIKE                            { $$ = make_str("ilike"); }
!         | IN                            { $$ = make_str("in"); }
          | INNER_P                        { $$ = make_str("inner"); }
          | IS                            { $$ = make_str("is"); }
          | ISNULL                        { $$ = make_str("isnull"); }
--- 5091,5097 ----
          | FREEZE                        { $$ = make_str("freeze"); }
          | FULL                            { $$ = make_str("full"); }
          | ILIKE                            { $$ = make_str("ilike"); }
!         | IN_P                            { $$ = make_str("in"); }
          | INNER_P                        { $$ = make_str("inner"); }
          | IS                            { $$ = make_str("is"); }
          | ISNULL                        { $$ = make_str("isnull"); }
***************
*** 5145,5151 ****
          | FOREIGN                        { $$ = make_str("foreign"); }
          | FROM                            { $$ = make_str("from"); }
          | GRANT                            { $$ = make_str("grant"); }
!         | GROUP                            { $$ = make_str("group"); }
          | HAVING                        { $$ = make_str("having"); }
          | INITIALLY                        { $$ = make_str("initially"); }
          | INTERSECT                        { $$ = make_str("intersect"); }
--- 5145,5151 ----
          | FOREIGN                        { $$ = make_str("foreign"); }
          | FROM                            { $$ = make_str("from"); }
          | GRANT                            { $$ = make_str("grant"); }
!         | GROUP_P                        { $$ = make_str("group"); }
          | HAVING                        { $$ = make_str("having"); }
          | INITIALLY                        { $$ = make_str("initially"); }
          | INTERSECT                        { $$ = make_str("intersect"); }
***************
*** 5305,5313 ****
          | SQL_SIGNED                { $$ = make_str("signed"); }
          | SQL_STRUCT                { $$ = make_str("struct"); }
          | SQL_UNSIGNED                { $$ = make_str("unsigned"); }
!         | CHAR                        { $$ = make_str("char"); }
          | DOUBLE                    { $$ = make_str("double"); }
!         | FLOAT                        { $$ = make_str("float"); }
          | UNION                        { $$ = make_str("union"); }
          | VARCHAR                    { $$ = make_str("varchar"); }
          | '['                        { $$ = make_str("["); }
--- 5305,5313 ----
          | SQL_SIGNED                { $$ = make_str("signed"); }
          | SQL_STRUCT                { $$ = make_str("struct"); }
          | SQL_UNSIGNED                { $$ = make_str("unsigned"); }
!         | CHAR_P                    { $$ = make_str("char"); }
          | DOUBLE                    { $$ = make_str("double"); }
!         | FLOAT_P                    { $$ = make_str("float"); }
          | UNION                        { $$ = make_str("union"); }
          | VARCHAR                    { $$ = make_str("varchar"); }
          | '['                        { $$ = make_str("["); }
Index: src/interfaces/libpq/fe-auth.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v
retrieving revision 1.65
diff -c -r1.65 fe-auth.c
*** src/interfaces/libpq/fe-auth.c    2002/04/24 23:00:40    1.65
--- src/interfaces/libpq/fe-auth.c    2002/06/10 17:44:33
***************
*** 714,720 ****
          char        username[128];
          DWORD        namesize = sizeof(username) - 1;

!         if (GetUserName(username, &namesize))
              name = username;
  #else
          struct passwd *pw = getpwuid(geteuid());
--- 714,720 ----
          char        username[128];
          DWORD        namesize = sizeof(username) - 1;

!         if (GetUserNameFromId(username, &namesize))
              name = username;
  #else
          struct passwd *pw = getpwuid(geteuid());

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: guc.c and postgresql.conf.sample constistency check
Next
From: Manfred Koizar
Date:
Subject: HeapTupleHeader accessor macros II