Inline function, rename libpq variablees, change lrel to lockrel.
authorBruce Momjian
Mon, 13 Jul 1998 16:35:04 +0000 (16:35 +0000)
committerBruce Momjian
Mon, 13 Jul 1998 16:35:04 +0000 (16:35 +0000)
14 files changed:
src/backend/libpq/be-dumpdata.c
src/backend/libpq/portal.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/ipc/sinvaladt.c
src/backend/storage/lmgr/lmgr.c
src/backend/storage/lmgr/multi.c
src/backend/storage/lmgr/single.c
src/include/libpq/libpq.h
src/include/storage/buf_internals.h
src/include/storage/lmgr.h
src/include/storage/multilev.h
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/libpq-fe.h
src/interfaces/odbc/pgtypes.c

index 2a7df53ee6b56575121a635bf3f5a065abf555ce..0f0a4b021c5d65bd00c2886ceb618ae23d221368 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.15 1998/03/30 16:46:29 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.16 1998/07/13 16:34:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -194,8 +194,8 @@ be_typeinit(PortalEntry *entry,
        for (i = 0; i < natts; ++i)
        {
            strncpy(group->types[i].name, attrs[i]->attname.data, NAMEDATALEN);
-           group->types[i].adtid = attrs[i]->atttypid;
-           group->types[i].adtsize = attrs[i]->attlen;
+           group->types[i].typid = attrs[i]->atttypid;
+           group->types[i].typlen = attrs[i]->attlen;
        }
    }
 }
index ac0d064a06afa6957314c2e5aaa641e667bd4232..ac5240e19266c38ebb4bc76685a79b2ffa985700 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.14 1998/06/15 19:28:27 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.15 1998/07/13 16:34:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -327,7 +327,7 @@ PQftypeGroup(PortalBuffer *portal, int group_index, int field_number)
 
    if ((gbp = pbuf_findGroup(portal, group_index)) &&
        in_range("PQftypeGroup: field number", field_number, 0, gbp->no_fields))
-       return (gbp->types[field_number].adtid);
+       return (gbp->types[field_number].typid);
    return (-1);
 }
 
@@ -348,7 +348,7 @@ PQfsizeGroup(PortalBuffer *portal, int group_index, int field_number)
 
    if ((gbp = pbuf_findGroup(portal, group_index)) &&
        in_range("PQfsizeGroup: field number", field_number, 0, gbp->no_fields))
-       return (gbp->types[field_number].adtsize);
+       return (gbp->types[field_number].typlen);
    return (-1);
 }
 
@@ -481,8 +481,8 @@ PQftype(PortalBuffer *portal, int tuple_index, int field_number)
        return (-1);
 
    if ((gbp = PQgroup(portal, tuple_index)) &&
-     in_range("PQftype: field number", field_number, 0, gbp->no_fields))
-       return (gbp->types[field_number].adtid);
+       in_range("PQftype: field number", field_number, 0, gbp->no_fields))
+       return (gbp->types[field_number].typid);
    return (-1);
 }
 
@@ -502,7 +502,7 @@ PQfsize(PortalBuffer *portal, int tuple_index, int field_number)
 
    if ((gbp = PQgroup(portal, tuple_index)) &&
      in_range("PQfsize: field number", field_number, 0, gbp->no_fields))
-       return (gbp->types[field_number].adtsize);
+       return (gbp->types[field_number].typlen);
    return (-1);
 }
 
index 324545cf959457e564b13e78eddea6ab006354bf..97664f76f67e5555ff34eec0b30242405706db64 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.38 1998/06/15 19:29:09 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.39 1998/07/13 16:34:49 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -114,14 +114,14 @@ RelationGetBufferWithBuffer(Relation relation,
                            Buffer buffer)
 {
    BufferDesc *bufHdr;
-   LRelId      lrelId;
+   LockRelId       lrelId;
 
    if (BufferIsValid(buffer))
    {
        if (!BufferIsLocal(buffer))
        {
            bufHdr = &BufferDescriptors[buffer - 1];
-           lrelId = RelationGetLRelId(relation);
+           lrelId = RelationGetLockRelId(relation);
            SpinAcquire(BufMgrLock);
            if (bufHdr->tag.blockNum == blockNumber &&
                bufHdr->tag.relId.relId == lrelId.relId &&
@@ -1282,7 +1282,7 @@ BufferGetRelation(Buffer buffer)
    Assert(!BufferIsLocal(buffer));     /* not supported for local buffers */
 
    /* XXX should be a critical section */
-   relid = LRelIdGetRelationId(BufferDescriptors[buffer - 1].tag.relId);
+   relid = LockRelIdGetRelationId(BufferDescriptors[buffer - 1].tag.relId);
    relation = RelationIdGetRelation(relid);
 
    RelationDecrementReferenceCount(relation);
index b54f4dc2211a79f27003b64c70ec6c56834f8543..1d0cedfa3ea4f21421d7fbeb8ba399dd67a01a3c 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.11 1998/06/27 04:53:36 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.12 1998/07/13 16:34:49 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -85,7 +85,7 @@ SISetActiveProcess(SISeg *segInOutP, BackendId backendId)
 int
 SIBackendInit(SISeg *segInOutP)
 {
-   LRelId      LtCreateRelId();
+   LockRelId       LtCreateRelId();
    TransactionId LMITransactionIdCopy();
 
    Assert(MyBackendTag > 0);
index 7fc61e8285ab59b540a8b322241ed173dba044a2..0f55f118634789dd55152721e6cf3d95739f5ab9 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.12 1998/06/15 19:29:19 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.13 1998/07/13 16:34:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,7 +47,7 @@
 #include "storage/bufmgr.h"
 #include "access/transam.h"        /* for AmiTransactionId */
 
-static void LRelIdAssign(LRelId *lRelId, Oid dbId, Oid relId);
+static void LockRelIdAssign(LockRelId *lockRelId, Oid dbId, Oid relId);
 
 /* ----------------
  *
@@ -68,68 +68,17 @@ static void LRelIdAssign(LRelId *lRelId, Oid dbId, Oid relId);
 
 extern Oid MyDatabaseId;
 
-static LRelId VariableRelationLRelId = {
+LockRelId VariableRelationLockRelId = {
    RelOid_pg_variable,
    InvalidOid
 };
 
-/* ----------------
- *     RelationGetLRelId
- * ----------------
- */
-#ifdef LOCKDEBUG
-#define LOCKDEBUG_10 \
-elog(NOTICE, "RelationGetLRelId(%s) invalid lockInfo", \
-    RelationGetRelationName(relation));
-#else
-#define LOCKDEBUG_10
-#endif                         /* LOCKDEBUG */
-
-/*
- * RelationGetLRelId --
- *     Returns "lock" relation identifier for a relation.
- */
-LRelId
-RelationGetLRelId(Relation relation)
-{
-   LockInfo    linfo;
-
-   /* ----------------
-    *  sanity checks
-    * ----------------
-    */
-   Assert(RelationIsValid(relation));
-   linfo = (LockInfo) relation->lockInfo;
-
-   /* ----------------
-    *  initialize lock info if necessary
-    * ----------------
-    */
-   if (!LockInfoIsValid(linfo))
-   {
-       LOCKDEBUG_10;
-       RelationInitLockInfo(relation);
-       linfo = (LockInfo) relation->lockInfo;
-   }
-
-   /* ----------------
-    * XXX hack to prevent problems during
-    * VARIABLE relation initialization
-    * ----------------
-    */
-   if (strcmp(RelationGetRelationName(relation)->data,
-              VariableRelationName) == 0)
-       return (VariableRelationLRelId);
-
-   return (linfo->lRelId);
-}
-
 /*
- * LRelIdGetDatabaseId --
+ * LockRelIdGetDatabaseId --
  *     Returns database identifier for a "lock" relation identifier.
  */
 /* ----------------
- *     LRelIdGetDatabaseId
+ *     LockRelIdGetDatabaseId
  *
  * Note: The argument may not be correct, if it is not used soon
  *      after it is created.
@@ -137,21 +86,21 @@ RelationGetLRelId(Relation relation)
  */
 #ifdef NOT_USED
 Oid
-LRelIdGetDatabaseId(LRelId lRelId)
+LockRelIdGetDatabaseId(LockRelId lockRelId)
 {
-   return (lRelId.dbId);
+   return (lockRelId.dbId);
 }
 
 #endif
 
 /*
- * LRelIdGetRelationId --
+ * LockRelIdGetRelationId --
  *     Returns relation identifier for a "lock" relation identifier.
  */
 Oid
-LRelIdGetRelationId(LRelId lRelId)
+LockRelIdGetRelationId(LockRelId lockRelId)
 {
-   return (lRelId.relId);
+   return (lockRelId.relId);
 }
 
 /*
@@ -169,15 +118,15 @@ DatabaseIdIsMyDatabaseId(Oid databaseId)
 #endif
 
 /*
- * LRelIdContainsMyDatabaseId --
+ * LockRelIdContainsMyDatabaseId --
  *     True iff "lock" relation identifier is valid in my present database.
  */
 #ifdef NOT_USED
 bool
-LRelIdContainsMyDatabaseId(LRelId lRelId)
+LockRelIdContainsMyDatabaseId(LockRelId lockRelId)
 {
    return (bool)
-   (!OidIsValid(lRelId.dbId) || lRelId.dbId == MyDatabaseId);
+   (!OidIsValid(lockRelId.dbId) || lockRelId.dbId == MyDatabaseId);
 }
 
 #endif
@@ -255,9 +204,9 @@ RelationInitLockInfo(Relation relation)
     * ----------------
     */
    if (IsSharedSystemRelationName(relname))
-       LRelIdAssign(&info->lRelId, InvalidOid, relationid);
+       LockRelIdAssign(&info->lockRelId, InvalidOid, relationid);
    else
-       LRelIdAssign(&info->lRelId, MyDatabaseId, relationid);
+       LockRelIdAssign(&info->lockRelId, MyDatabaseId, relationid);
 
    /* ----------------
     *  store the transaction id in the lockInfo field
@@ -319,7 +268,7 @@ RelationDiscardLockInfo(Relation relation)
 #ifdef LOCKDEBUGALL
 #define LOCKDEBUGALL_30 \
 elog(DEBUG, "RelationSetLockForDescriptorOpen(%s[%d,%d]) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId)
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId)
 #else
 #define LOCKDEBUGALL_30
 #endif                         /* LOCKDEBUGALL */
@@ -351,7 +300,7 @@ RelationSetLockForDescriptorOpen(Relation relation)
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_40 \
 elog(DEBUG, "RelationSetLockForRead(%s[%d,%d]) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId)
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId)
 #else
 #define LOCKDEBUG_40
 #endif                         /* LOCKDEBUG */
@@ -363,7 +312,7 @@ elog(DEBUG, "RelationSetLockForRead(%s[%d,%d]) called", \
 void
 RelationSetLockForRead(Relation relation)
 {
-   LockInfo    linfo;
+   LockInfo    lockinfo;
 
    /* ----------------
     *  sanity checks
@@ -383,15 +332,15 @@ RelationSetLockForRead(Relation relation)
    if (!LockInfoIsValid(relation->lockInfo))
    {
        RelationInitLockInfo(relation);
-       linfo = (LockInfo) relation->lockInfo;
-       linfo->flags |= ReadRelationLock;
-       MultiLockReln(linfo, READ_LOCK);
+       lockinfo = (LockInfo) relation->lockInfo;
+       lockinfo->flags |= ReadRelationLock;
+       MultiLockReln(lockinfo, READ_LOCK);
        return;
    }
    else
-       linfo = (LockInfo) relation->lockInfo;
+       lockinfo = (LockInfo) relation->lockInfo;
 
-   MultiLockReln(linfo, READ_LOCK);
+   MultiLockReln(lockinfo, READ_LOCK);
 }
 
 /* ----------------
@@ -401,7 +350,7 @@ RelationSetLockForRead(Relation relation)
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_50 \
 elog(DEBUG, "RelationUnsetLockForRead(%s[%d,%d]) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId)
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId)
 #else
 #define LOCKDEBUG_50
 #endif                         /* LOCKDEBUG */
@@ -413,7 +362,7 @@ elog(DEBUG, "RelationUnsetLockForRead(%s[%d,%d]) called", \
 void
 RelationUnsetLockForRead(Relation relation)
 {
-   LockInfo    linfo;
+   LockInfo    lockinfo;
 
    /* ----------------
     *  sanity check
@@ -423,21 +372,21 @@ RelationUnsetLockForRead(Relation relation)
    if (LockingDisabled())
        return;
 
-   linfo = (LockInfo) relation->lockInfo;
+   lockinfo = (LockInfo) relation->lockInfo;
 
    /* ----------------
     * If we don't have lock info on the reln just go ahead and
     * release it.
     * ----------------
     */
-   if (!LockInfoIsValid(linfo))
+   if (!LockInfoIsValid(lockinfo))
    {
        elog(ERROR,
             "Releasing a lock on %s with invalid lock information",
             RelationGetRelationName(relation));
    }
 
-   MultiReleaseReln(linfo, READ_LOCK);
+   MultiReleaseReln(lockinfo, READ_LOCK);
 }
 
 /* ----------------
@@ -447,7 +396,7 @@ RelationUnsetLockForRead(Relation relation)
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_60 \
 elog(DEBUG, "RelationSetLockForWrite(%s[%d,%d]) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId)
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId)
 #else
 #define LOCKDEBUG_60
 #endif                         /* LOCKDEBUG */
@@ -459,7 +408,7 @@ elog(DEBUG, "RelationSetLockForWrite(%s[%d,%d]) called", \
 void
 RelationSetLockForWrite(Relation relation)
 {
-   LockInfo    linfo;
+   LockInfo    lockinfo;
 
    /* ----------------
     *  sanity checks
@@ -479,15 +428,15 @@ RelationSetLockForWrite(Relation relation)
    if (!LockInfoIsValid(relation->lockInfo))
    {
        RelationInitLockInfo(relation);
-       linfo = (LockInfo) relation->lockInfo;
-       linfo->flags |= WriteRelationLock;
-       MultiLockReln(linfo, WRITE_LOCK);
+       lockinfo = (LockInfo) relation->lockInfo;
+       lockinfo->flags |= WriteRelationLock;
+       MultiLockReln(lockinfo, WRITE_LOCK);
        return;
    }
    else
-       linfo = (LockInfo) relation->lockInfo;
+       lockinfo = (LockInfo) relation->lockInfo;
 
-   MultiLockReln(linfo, WRITE_LOCK);
+   MultiLockReln(lockinfo, WRITE_LOCK);
 }
 
 /* ----------------
@@ -497,7 +446,7 @@ RelationSetLockForWrite(Relation relation)
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_70 \
 elog(DEBUG, "RelationUnsetLockForWrite(%s[%d,%d]) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId);
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId)
 #else
 #define LOCKDEBUG_70
 #endif                         /* LOCKDEBUG */
@@ -509,7 +458,7 @@ elog(DEBUG, "RelationUnsetLockForWrite(%s[%d,%d]) called", \
 void
 RelationUnsetLockForWrite(Relation relation)
 {
-   LockInfo    linfo;
+   LockInfo    lockinfo;
 
    /* ----------------
     *  sanity checks
@@ -519,16 +468,16 @@ RelationUnsetLockForWrite(Relation relation)
    if (LockingDisabled())
        return;
 
-   linfo = (LockInfo) relation->lockInfo;
+   lockinfo = (LockInfo) relation->lockInfo;
 
-   if (!LockInfoIsValid(linfo))
+   if (!LockInfoIsValid(lockinfo))
    {
        elog(ERROR,
             "Releasing a lock on %s with invalid lock information",
             RelationGetRelationName(relation));
    }
 
-   MultiReleaseReln(linfo, WRITE_LOCK);
+   MultiReleaseReln(lockinfo, WRITE_LOCK);
 }
 
 /* ----------------
@@ -538,10 +487,10 @@ RelationUnsetLockForWrite(Relation relation)
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_80 \
 elog(DEBUG, "RelationSetLockForTupleRead(%s[%d,%d], 0x%x) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId, \
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId, \
     itemPointer)
 #define LOCKDEBUG_81 \
-    elog(DEBUG, "RelationSetLockForTupleRead() escalating");
+    elog(DEBUG, "RelationSetLockForTupleRead() escalating")
 #else
 #define LOCKDEBUG_80
 #define LOCKDEBUG_81
@@ -555,7 +504,7 @@ elog(DEBUG, "RelationSetLockForTupleRead(%s[%d,%d], 0x%x) called", \
 void
 RelationSetLockForTupleRead(Relation relation, ItemPointer itemPointer)
 {
-   LockInfo    linfo;
+   LockInfo    lockinfo;
    TransactionId curXact;
 
    /* ----------------
@@ -576,71 +525,71 @@ RelationSetLockForTupleRead(Relation relation, ItemPointer itemPointer)
    if (!LockInfoIsValid(relation->lockInfo))
    {
        RelationInitLockInfo(relation);
-       linfo = (LockInfo) relation->lockInfo;
-       linfo->flags |=
+       lockinfo = (LockInfo) relation->lockInfo;
+       lockinfo->flags |=
            IntentReadRelationLock |
            IntentReadPageLock |
            ReadTupleLock;
-       MultiLockTuple(linfo, itemPointer, READ_LOCK);
+       MultiLockTuple(lockinfo, itemPointer, READ_LOCK);
        return;
    }
    else
-       linfo = (LockInfo) relation->lockInfo;
+       lockinfo = (LockInfo) relation->lockInfo;
 
    /* ----------------
     *  no need to set a lower granularity lock
     * ----------------
     */
    curXact = GetCurrentTransactionId();
-   if ((linfo->flags & ReadRelationLock) &&
-       TransactionIdEquals(curXact, linfo->transactionIdData))
+   if ((lockinfo->flags & ReadRelationLock) &&
+       TransactionIdEquals(curXact, lockinfo->transactionIdData))
        return;
 
    /* ----------------
     * If we don't already have a tuple lock this transaction
     * ----------------
     */
-   if (!((linfo->flags & ReadTupleLock) &&
-         TransactionIdEquals(curXact, linfo->transactionIdData)))
+   if (!((lockinfo->flags & ReadTupleLock) &&
+         TransactionIdEquals(curXact, lockinfo->transactionIdData)))
    {
 
-       linfo->flags |=
+       lockinfo->flags |=
            IntentReadRelationLock |
            IntentReadPageLock |
            ReadTupleLock;
 
        /* clear count */
-       linfo->flags &= ~TupleLevelLockCountMask;
+       lockinfo->flags &= ~TupleLevelLockCountMask;
 
    }
    else
    {
        if (TupleLevelLockLimit == (TupleLevelLockCountMask &
-                                   linfo->flags))
+                                   lockinfo->flags))
        {
            LOCKDEBUG_81;
 
            /* escalate */
-           MultiLockReln(linfo, READ_LOCK);
+           MultiLockReln(lockinfo, READ_LOCK);
 
            /* clear count */
-           linfo->flags &= ~TupleLevelLockCountMask;
+           lockinfo->flags &= ~TupleLevelLockCountMask;
            return;
        }
 
        /* increment count */
-       linfo->flags =
-           (linfo->flags & ~TupleLevelLockCountMask) |
-           (1 + (TupleLevelLockCountMask & linfo->flags));
+       lockinfo->flags =
+           (lockinfo->flags & ~TupleLevelLockCountMask) |
+           (1 + (TupleLevelLockCountMask & lockinfo->flags));
    }
 
-   TransactionIdStore(curXact, &linfo->transactionIdData);
+   TransactionIdStore(curXact, &lockinfo->transactionIdData);
 
    /* ----------------
     * Lock the tuple.
     * ----------------
     */
-   MultiLockTuple(linfo, itemPointer, READ_LOCK);
+   MultiLockTuple(lockinfo, itemPointer, READ_LOCK);
 }
 
 #endif
@@ -652,7 +601,7 @@ RelationSetLockForTupleRead(Relation relation, ItemPointer itemPointer)
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_90 \
 elog(DEBUG, "RelationSetLockForReadPage(%s[%d,%d], @%d) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId, page);
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId, page)
 #else
 #define LOCKDEBUG_90
 #endif                         /* LOCKDEBUG */
@@ -664,7 +613,7 @@ elog(DEBUG, "RelationSetLockForReadPage(%s[%d,%d], @%d) called", \
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_100 \
 elog(DEBUG, "RelationSetLockForWritePage(%s[%d,%d], @%d) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId, page);
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId, page)
 #else
 #define LOCKDEBUG_100
 #endif                         /* LOCKDEBUG */
@@ -686,7 +635,7 @@ RelationSetLockForWritePage(Relation relation,
        return;
 
    /* ---------------
-    * Make sure linfo is initialized
+    * Make sure lockinfo is initialized
     * ---------------
     */
    if (!LockInfoIsValid(relation->lockInfo))
@@ -706,7 +655,7 @@ RelationSetLockForWritePage(Relation relation,
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_110 \
 elog(DEBUG, "RelationUnsetLockForReadPage(%s[%d,%d], @%d) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId, page)
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId, page)
 #else
 #define LOCKDEBUG_110
 #endif                         /* LOCKDEBUG */
@@ -718,7 +667,7 @@ elog(DEBUG, "RelationUnsetLockForReadPage(%s[%d,%d], @%d) called", \
 #ifdef LOCKDEBUG
 #define LOCKDEBUG_120 \
 elog(DEBUG, "RelationUnsetLockForWritePage(%s[%d,%d], @%d) called", \
-    RelationGetRelationName(relation), lRelId.dbId, lRelId.relId, page)
+    RelationGetRelationName(relation), lockRelId.dbId, lockRelId.relId, page)
 #else
 #define LOCKDEBUG_120
 #endif                         /* LOCKDEBUG */
@@ -950,11 +899,11 @@ RelationUnsetLockForExtend(Relation relation)
 #endif
 
 /*
- * Create an LRelid --- Why not just pass in a pointer to the storage?
+ * Create an LockRelid --- Why not just pass in a pointer to the storage?
  */
 static void
-LRelIdAssign(LRelId *lRelId, Oid dbId, Oid relId)
+LockRelIdAssign(LockRelId *lockRelId, Oid dbId, Oid relId)
 {
-   lRelId->dbId = dbId;
-   lRelId->relId = relId;
+   lockRelId->dbId = dbId;
+   lockRelId->relId = relId;
 }
index beb6d2fde8bbd006757150b8e930641f9409b827..7fbd738b7450306b2349953837e4fd88a1b4bd72 100644 (file)
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.19 1998/06/30 02:33:31 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.20 1998/07/13 16:34:51 momjian Exp $
  *
  * NOTES:
  *  (1) The lock.c module assumes that the caller here is doing
@@ -113,7 +113,7 @@ InitMultiLevelLocks()
  * Returns: TRUE if the lock can be set, FALSE otherwise.
  */
 bool
-MultiLockReln(LockInfo linfo, LOCKMODE lockmode)
+MultiLockReln(LockInfo lockinfo, LOCKMODE lockmode)
 {
    LOCKTAG     tag;
 
@@ -122,8 +122,8 @@ MultiLockReln(LockInfo linfo, LOCKMODE lockmode)
     * will return miss if the padding bytes aren't zero'd.
     */
    MemSet(&tag, 0, sizeof(tag));
-   tag.relId = linfo->lRelId.relId;
-   tag.dbId = linfo->lRelId.dbId;
+   tag.relId = lockinfo->lockRelId.relId;
+   tag.dbId = lockinfo->lockRelId.dbId;
    return (MultiAcquire(MultiTableId, &tag, lockmode, RELN_LEVEL));
 }
 
@@ -136,7 +136,7 @@ MultiLockReln(LockInfo linfo, LOCKMODE lockmode)
  *     at the page and relation level.
  */
 bool
-MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
+MultiLockTuple(LockInfo lockinfo, ItemPointer tidPtr, LOCKMODE lockmode)
 {
    LOCKTAG     tag;
 
@@ -146,8 +146,8 @@ MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
     */
    MemSet(&tag, 0, sizeof(tag));
 
-   tag.relId = linfo->lRelId.relId;
-   tag.dbId = linfo->lRelId.dbId;
+   tag.relId = lockinfo->lockRelId.relId;
+   tag.dbId = lockinfo->lockRelId.dbId;
 
    /* not locking any valid Tuple, just the page */
    tag.tupleId = *tidPtr;
@@ -158,7 +158,7 @@ MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
  * same as above at page level
  */
 bool
-MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
+MultiLockPage(LockInfo lockinfo, ItemPointer tidPtr, LOCKMODE lockmode)
 {
    LOCKTAG     tag;
 
@@ -178,8 +178,8 @@ MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
     * when we say lock the page we mean the 8k block. -Jeff 16 July 1991
     * ----------------------------
     */
-   tag.relId = linfo->lRelId.relId;
-   tag.dbId = linfo->lRelId.dbId;
+   tag.relId = lockinfo->lockRelId.relId;
+   tag.dbId = lockinfo->lockRelId.dbId;
    BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
    return (MultiAcquire(MultiTableId, &tag, lockmode, PAGE_LEVEL));
 }
@@ -302,7 +302,7 @@ MultiAcquire(LOCKMETHOD lockmethod,
  */
 #ifdef NOT_USED
 bool
-MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
+MultiReleasePage(LockInfo lockinfo, ItemPointer tidPtr, LOCKMODE lockmode)
 {
    LOCKTAG     tag;
 
@@ -314,8 +314,8 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
     */
    MemSet(&tag, 0, sizeof(LOCKTAG));
 
-   tag.relId = linfo->lRelId.relId;
-   tag.dbId = linfo->lRelId.dbId;
+   tag.relId = lockinfo->lockRelId.relId;
+   tag.dbId = lockinfo->lockRelId.dbId;
    BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
 
    return (MultiRelease(MultiTableId, &tag, lockmode, PAGE_LEVEL));
@@ -328,7 +328,7 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
  * ------------------
  */
 bool
-MultiReleaseReln(LockInfo linfo, LOCKMODE lockmode)
+MultiReleaseReln(LockInfo lockinfo, LOCKMODE lockmode)
 {
    LOCKTAG     tag;
 
@@ -339,8 +339,8 @@ MultiReleaseReln(LockInfo linfo, LOCKMODE lockmode)
     * ------------------
     */
    MemSet(&tag, 0, sizeof(LOCKTAG));
-   tag.relId = linfo->lRelId.relId;
-   tag.dbId = linfo->lRelId.dbId;
+   tag.relId = lockinfo->lockRelId.relId;
+   tag.dbId = lockinfo->lockRelId.dbId;
 
    return (MultiRelease(MultiTableId, &tag, lockmode, RELN_LEVEL));
 }
index d58657b2c33d74c70885c1763ccd22eddd925bb0..7d1876640d99c7fd9f91c42fe22494eb529f398f 100644 (file)
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.7 1998/06/30 02:33:32 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.8 1998/07/13 16:34:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -32,7 +32,7 @@
  * Returns: TRUE if the lock can be set, FALSE otherwise.
  */
 bool
-SingleLockReln(LockInfo linfo, LOCKMODE lockmode, int action)
+SingleLockReln(LockInfo lockinfo, LOCKMODE lockmode, int action)
 {
    LOCKTAG     tag;
 
@@ -41,8 +41,8 @@ SingleLockReln(LockInfo linfo, LOCKMODE lockmode, int action)
     * will return miss if the padding bytes aren't zero'd.
     */
    MemSet(&tag, 0, sizeof(tag));
-   tag.relId = linfo->lRelId.relId;
-   tag.dbId = linfo->lRelId.dbId;
+   tag.relId = lockinfo->lockRelId.relId;
+   tag.dbId = lockinfo->lockRelId.dbId;
    BlockIdSet(&(tag.tupleId.ip_blkid), InvalidBlockNumber);
    tag.tupleId.ip_posid = InvalidOffsetNumber;
 
@@ -61,7 +61,7 @@ SingleLockReln(LockInfo linfo, LOCKMODE lockmode, int action)
  *
  */
 bool
-SingleLockPage(LockInfo linfo,
+SingleLockPage(LockInfo lockinfo,
               ItemPointer tidPtr,
               LOCKMODE lockmode,
               int action)
@@ -73,8 +73,8 @@ SingleLockPage(LockInfo linfo,
     * will return miss if the padding bytes aren't zero'd.
     */
    MemSet(&tag, 0, sizeof(tag));
-   tag.relId = linfo->lRelId.relId;
-   tag.dbId = linfo->lRelId.dbId;
+   tag.relId = lockinfo->lockRelId.relId;
+   tag.dbId = lockinfo->lockRelId.dbId;
    BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
    tag.tupleId.ip_posid = InvalidOffsetNumber;
 
index 804bdf0cc482a8a6246e3b9d66dd9317370bf983..6f53b6b5b564878af19aab3b8cdb079face8c2d0 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq.h,v 1.17 1998/07/09 03:29:01 scrappy Exp $
+ * $Id: libpq.h,v 1.18 1998/07/13 16:34:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,8 +49,8 @@ typedef struct
 typedef struct TypeBlock
 {
    char        name[NAMEDATALEN];      /* name of the attribute */
-   int         adtid;          /* adtid of the type */
-   int         adtsize;        /* adtsize of the type */
+   int         typid;          /* typid of the type */
+   int         typlen;     /* typlen of the type */
 } TypeBlock;
 
 /* ----------------
index ac9f76182cc15a3755a659380c8c3347967ad328..ab4a6f288dc8b631d40e0f4baedaff015064ef98 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: buf_internals.h,v 1.22 1998/06/15 18:40:01 momjian Exp $
+ * $Id: buf_internals.h,v 1.23 1998/07/13 16:34:55 momjian Exp $
  *
  * NOTE
  *     If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -51,7 +51,7 @@ typedef long **BufferBlock;
 
 struct buftag
 {
-   LRelId      relId;
+   LockRelId       relId;
    BlockNumber blockNum;       /* blknum relative to begin of reln */
 };
 
@@ -65,14 +65,14 @@ struct buftag
 #define INIT_BUFFERTAG(a,xx_reln,xx_blockNum) \
 ( \
    (a)->blockNum = xx_blockNum, \
-   (a)->relId = RelationGetLRelId(xx_reln) \
+   (a)->relId = RelationGetLockRelId(xx_reln) \
 )
 
 #ifdef NOT_USED
 #define COPY_BUFFERTAG(a,b) \
 ( \
    (a)->blockNum = (b)->blockNum, \
-   LRelIdAssign(*(a),*(b)) \
+   LockRelIdAssign(*(a),*(b)) \
 )
 
 #define EQUAL_BUFFERTAG(a,b) \
index f0371dc29a2c517d10aeee829362fa322912a569..818a2f09e59131a2f6d10f4c0323d0d26e5edf5d 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lmgr.h,v 1.12 1998/06/30 02:33:32 momjian Exp $
+ * $Id: lmgr.h,v 1.13 1998/07/13 16:34:56 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include 
 #include 
+#include 
 
 /*
  * This was moved from pladt.h for the new lock manager.  Want to obsolete
  * all of the old code.
  */
-typedef struct LRelId
+typedef struct LockRelId
 {
    Oid         relId;          /* a relation identifier */
    Oid         dbId;           /* a database identifier */
-} LRelId;
+} LockRelId;
 
 typedef struct LockInfoData
 {
    bool        initialized;
-   LRelId      lRelId;
+   LockRelId   lockRelId;
    TransactionId transactionIdData;
    uint16      flags;
 } LockInfoData;
 typedef LockInfoData *LockInfo;
 
-#define LockInfoIsValid(linfo) \
-       ((PointerIsValid(linfo)) &&  ((LockInfo) linfo)->initialized)
+#define LockInfoIsValid(lockinfo) \
+       ((PointerIsValid(lockinfo)) &&  ((LockInfo) lockinfo)->initialized)
+
+extern LockRelId VariableRelationLockRelId;
+       
+/*
+ * RelationGetLockRelId --
+ *     Returns "lock" relation identifier for a relation.
+ */
+/* ----------------
+ * final condition is a hack to prevent problems during
+ * VARIABLE relation initialization
+ * ----------------
+ */
+#define RelationGetLockRelId(relation) \
+( \
+   AssertMacro(RelationIsValid(relation)), \
+   (!LockInfoIsValid((LockInfo)(relation)->lockInfo)) ? \
+       RelationInitLockInfo(relation) \
+   : \
+       (void)NULL, \
+   (strcmp(RelationGetRelationName(relation)->data, \
+           VariableRelationName) == 0) ? \
+       VariableRelationLockRelId \
+   : \
+       ((LockInfo)(relation)->lockInfo)->lockRelId \
+)
 
 
-extern LRelId RelationGetLRelId(Relation relation);
-extern Oid LRelIdGetRelationId(LRelId lRelId);
+extern Oid LockRelIdGetRelationId(LockRelId lockRelId);
 extern void RelationInitLockInfo(Relation relation);
 extern void RelationSetLockForDescriptorOpen(Relation relation);
 extern void RelationSetLockForRead(Relation relation);
@@ -72,9 +97,9 @@ extern void RelationSetWIntentLock(Relation relation);
 extern void RelationUnsetWIntentLock(Relation relation);
 
 /* single.c */
-extern bool SingleLockReln(LockInfo linfo, LOCKMODE lockmode, int action);
+extern bool SingleLockReln(LockInfo lockinfo, LOCKMODE lockmode, int action);
 extern bool
-SingleLockPage(LockInfo linfo, ItemPointer tidPtr,
+SingleLockPage(LockInfo lockinfo, ItemPointer tidPtr,
               LOCKMODE lockmode, int action);
 
 /* proc.c */
index 95091c9f620a2449d64cebb7a65c3fceb301e82c..ced76b9f4266d5b677f728583ff275b96d5a7c49 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: multilev.h,v 1.10 1998/06/30 02:33:33 momjian Exp $
+ * $Id: multilev.h,v 1.11 1998/07/13 16:34:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,9 +52,9 @@ extern LOCKMETHOD ShortTermTableId;
  * function prototypes
  */
 extern LOCKMETHOD InitMultiLevelLocks(void);
-extern bool MultiLockReln(LockInfo linfo, LOCKMODE lockmode);
-extern bool MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode);
-extern bool MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode);
-extern bool MultiReleaseReln(LockInfo linfo, LOCKMODE lockmode);
+extern bool MultiLockReln(LockInfo lockinfo, LOCKMODE lockmode);
+extern bool MultiLockTuple(LockInfo lockinfo, ItemPointer tidPtr, LOCKMODE lockmode);
+extern bool MultiLockPage(LockInfo lockinfo, ItemPointer tidPtr, LOCKMODE lockmode);
+extern bool MultiReleaseReln(LockInfo lockinfo, LOCKMODE lockmode);
 
 #endif                         /* MULTILEV_H */
index 2a80e2215caa7b0f9cf7925c5ee9c4674356839c..0feb26ca31c80d7bb86713892a720112d2b04a88 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.58 1998/07/13 02:41:58 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.59 1998/07/13 16:35:00 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -497,12 +497,12 @@ getRowDescriptions(PGconn *conn)
    for (i = 0; i < nfields; i++)
    {
        char        typName[MAX_MESSAGE_LEN];
-       int         adtid;
+       int         typid;
        int         typlen;
        int         atttypmod = -1;
 
        if (pqGets(typName, MAX_MESSAGE_LEN, conn) ||
-           pqGetInt(&adtid, 4, conn) ||
+           pqGetInt(&typid, 4, conn) ||
            pqGetInt(&typlen, 2, conn) ||
            pqGetInt(&atttypmod, 4, conn))
        {
@@ -510,7 +510,7 @@ getRowDescriptions(PGconn *conn)
            return EOF;
        }
        result->attDescs[i].name = strdup(typName);
-       result->attDescs[i].adtid = adtid;
+       result->attDescs[i].typid = typid;
        result->attDescs[i].typlen = (short) typlen;
        result->attDescs[i].atttypmod = atttypmod;
    }
@@ -1272,7 +1272,7 @@ PQftype(PGresult *res, int field_num)
        return InvalidOid;
    }
    if (res->attDescs)
-       return res->attDescs[field_num].adtid;
+       return res->attDescs[field_num].typid;
    else
        return InvalidOid;
 }
index 0067199ccff4f77e212842959cd79bbed5639c63..262f7629e39840646fc6c0fe8685b852e3db401c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq-fe.h,v 1.33 1998/07/13 02:41:59 momjian Exp $
+ * $Id: libpq-fe.h,v 1.34 1998/07/13 16:35:02 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,8 +76,8 @@ extern        "C"
    typedef struct pgresAttDesc
    {
        char       *name;       /* type name */
-       Oid         adtid;      /* type id */
-       short       adtsize;    /* type size */
+       Oid         typid;      /* type id */
+       short       typlen; /* type size */
        int         atttypmod;  /* type-specific modifier info */
    } PGresAttDesc;
 
index b52ef601e9b17f8807f3955add77c01fc29c5ef9..e5cfa86c5f9fc033b2e42451b39cc4e4770c8aba 100644 (file)
@@ -223,7 +223,7 @@ mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unkno
    if (stmt->manual_result) {
        flds = result->fields;
        if (flds)
-           return flds->adtsize[col];
+           return flds->typlen[col];
        else
            return maxsize;
    }