*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.27 1997/09/24 17:44:24 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.28 1997/11/02 15:24:09 vadim Exp $
*
* NOTES
* The old interface functions have been converted to macros
TupleDesc tupleDesc,
Datum value[],
char nulls[],
- char *infomask,
+ uint16 *infomask,
bits8 *bit)
{
bits8 *bitP = 0;
case MinCommandIdAttributeNumber:
case MaxTransactionIdAttributeNumber:
case MaxCommandIdAttributeNumber:
- case ChainItemPointerAttributeNumber:
- case AnchorItemPointerAttributeNumber:
- case MinAbsoluteTimeAttributeNumber:
- case MaxAbsoluteTimeAttributeNumber:
- case VersionTypeAttributeNumber:
break;
case 0:
return sizeof f->t_xmax;
case MaxCommandIdAttributeNumber:
return sizeof f->t_cmax;
- case ChainItemPointerAttributeNumber:
- return sizeof f->t_chain;
- case MinAbsoluteTimeAttributeNumber:
- return sizeof f->t_tmin;
- case MaxAbsoluteTimeAttributeNumber:
- return sizeof f->t_tmax;
- case VersionTypeAttributeNumber:
- return sizeof f->t_vtype;
-
- case AnchorItemPointerAttributeNumber:
- elog(WARN, "heap_sysattrlen: field t_anchor does not exist!");
- return 0;
default:
elog(WARN, "sysattrlen: System attribute number %d unknown.", attno);
case MaxCommandIdAttributeNumber:
byval = true;
break;
- case ChainItemPointerAttributeNumber:
- byval = false;
- break;
- case AnchorItemPointerAttributeNumber:
- byval = false;
- break;
- case MinAbsoluteTimeAttributeNumber:
- byval = true;
- break;
- case MaxAbsoluteTimeAttributeNumber:
- byval = true;
- break;
- case VersionTypeAttributeNumber:
- byval = true;
- break;
default:
byval = true;
elog(WARN, "sysattrbyval: System attribute number %d unknown.",
{
switch (attnum)
{
- case SelfItemPointerAttributeNumber:
+ case SelfItemPointerAttributeNumber:
return ((Datum) &tup->t_ctid);
case ObjectIdAttributeNumber:
return ((Datum) (long) tup->t_oid);
return ((Datum) (long) tup->t_xmax);
case MaxCommandIdAttributeNumber:
return ((Datum) (long) tup->t_cmax);
- case ChainItemPointerAttributeNumber:
- return ((Datum) &tup->t_chain);
- case AnchorItemPointerAttributeNumber:
- elog(WARN, "heap_getsysattr: t_anchor does not exist!");
- break;
-
- /*
- * For tmin and tmax, we need to do some extra work. These
- * don't get filled in until the vacuum cleaner runs (or we
- * manage to flush a page after setting the value correctly
- * below). If the vacuum cleaner hasn't run yet, then the
- * times stored in the tuple are wrong, and we need to look up
- * the commit time of the transaction. We cache this value in
- * the tuple to avoid doing the work more than once.
- */
-
- case MinAbsoluteTimeAttributeNumber:
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tup->t_tmin) &&
- TransactionIdDidCommit(tup->t_xmin))
- tup->t_tmin = TransactionIdGetCommitTime(tup->t_xmin);
- return ((Datum) (long) tup->t_tmin);
- case MaxAbsoluteTimeAttributeNumber:
- if (!AbsoluteTimeIsBackwardCompatiblyReal(tup->t_tmax))
- {
- if (TransactionIdDidCommit(tup->t_xmax))
- tup->t_tmax = TransactionIdGetCommitTime(tup->t_xmax);
- else
- tup->t_tmax = CURRENT_ABSTIME;
- }
- return ((Datum) (long) tup->t_tmax);
- case VersionTypeAttributeNumber:
- return ((Datum) (long) tup->t_vtype);
default:
elog(WARN, "heap_getsysattr: undefined attnum %d", attnum);
}
tuple->t_len = len;
tuple->t_natts = numberOfAttributes;
tuple->t_hoff = hoff;
- tuple->t_tmin = INVALID_ABSTIME;
- tuple->t_tmax = CURRENT_ABSTIME;
DataFill((char *) tuple + tuple->t_hoff,
tupleDescriptor,
&tuple->t_infomask,
(hasnull ? tuple->t_bits : NULL));
+ tuple->t_infomask |= HEAP_XMAX_INVALID;
+
return (tuple);
}
* ----------------
*/
infomask = newTuple->t_infomask;
- memmove((char *) &newTuple->t_ctid, /* XXX */
- (char *) &tuple->t_ctid,
- ((char *) &tuple->t_hoff - (char *) &tuple->t_ctid)); /* XXX */
+ memmove((char *) &newTuple->t_oid, /* XXX */
+ (char *) &tuple->t_oid,
+ ((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
newTuple->t_infomask = infomask;
newTuple->t_natts = numberOfAttributes; /* fix t_natts just in
* case */
tup = (HeapTuple) tp;
MemSet((char *) tup, 0, len);
- tup->t_len = (short) len; /* XXX */
+ tup->t_len = len;
tp += tup->t_hoff = hoff;
tup->t_natts = natts;
tup->t_infomask = 0;
+ tup->t_infomask |= HEAP_XMAX_INVALID;
memmove(tp, structure, structlen);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.19 1997/09/18 20:19:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.20 1997/11/02 15:24:11 vadim Exp $
*
*-------------------------------------------------------------------------
*/
int i;
unsigned short infomask = 0;
bool hasnull = false;
- char tupmask = 0;
+ uint16 tupmask = 0;
int numberOfAttributes = tupleDescriptor->natts;
if (numberOfAttributes > MaxIndexAttributeNumber)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.20 1997/09/18 14:19:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.21 1997/11/02 15:24:26 vadim Exp $
*
*
* INTERFACE ROUTINES
TransactionIdStore(GetCurrentTransactionId(), &(tup->t_xmin));
tup->t_cmin = GetCurrentCommandId();
StoreInvalidTransactionId(&(tup->t_xmax));
- tup->t_tmin = INVALID_ABSTIME;
- tup->t_tmax = CURRENT_ABSTIME;
+ tup->t_infomask &= ~(HEAP_XACT_MASK);
+ tup->t_infomask |= HEAP_XMAX_INVALID;
doinsert(relation, tup);
*/
TransactionIdStore(GetCurrentTransactionId(), &(tp->t_xmax));
tp->t_cmax = GetCurrentCommandId();
- ItemPointerSetInvalid(&tp->t_chain);
+ tp->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID);
/* ----------------
* invalidate caches
TransactionIdStore(GetCurrentTransactionId(), &(tup->t_xmin));
tup->t_cmin = GetCurrentCommandId();
StoreInvalidTransactionId(&(tup->t_xmax));
- tup->t_tmin = INVALID_ABSTIME;
- tup->t_tmax = CURRENT_ABSTIME;
- ItemPointerSetInvalid(&tup->t_chain);
+ tup->t_infomask &= ~(HEAP_XACT_MASK);
+ tup->t_infomask |= HEAP_XMAX_INVALID;
/* ----------------
* insert new item
*/
TransactionIdStore(GetCurrentTransactionId(), &(tp->t_xmax));
tp->t_cmax = GetCurrentCommandId();
- tp->t_chain = tup->t_ctid;
+ tp->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID);
/* ----------------
* invalidate caches
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.13 1997/09/08 21:41:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.14 1997/11/02 15:24:42 vadim Exp $
*
* NOTES
* This file contains the high level access-method interface to the
*/
Relation LogRelation = (Relation) NULL;
-Relation TimeRelation = (Relation) NULL;
Relation VariableRelation = (Relation) NULL;
/* ----------------
* global variables holding cached transaction id's and statuses.
* ----------------
*/
-TransactionId cachedGetCommitTimeXid;
-AbsoluteTime cachedGetCommitTime;
-TransactionId cachedTestXid;
-XidStatus cachedTestXidStatus;
+TransactionId cachedTestXid;
+XidStatus cachedTestXidStatus;
/* ----------------
* transaction system constants
#endif
/* ----------------------------------------------------------------
- * postgres log/time access method interface
+ * postgres log access method interface
*
* TransactionLogTest
* TransactionLogUpdate
{
BlockNumber blockNumber;
bool fail = false; /* success/failure */
- AbsoluteTime currentTime; /* time of this transaction */
/* ----------------
* during initialization we don't record any updates.
if (!RelationIsValid(LogRelation))
return;
- /* ----------------
- * get the transaction commit time
- * ----------------
- */
- currentTime = getSystemTime();
-
/* ----------------
* update the log relation
* ----------------
* update (invalidate) our single item TransactionLogTest cache.
* ----------------
*/
- TransactionIdStore(transactionId, &cachedTestXid);
- cachedTestXidStatus = status;
-
- /* ----------------
- * now we update the time relation, if necessary
- * (we only record commit times)
- * ----------------
- */
- if (RelationIsValid(TimeRelation) && status == XID_COMMIT)
+ if (status != XID_COMMIT)
{
- TransComputeBlockNumber(TimeRelation, transactionId, &blockNumber);
- TransBlockNumberSetCommitTime(TimeRelation,
- blockNumber,
- transactionId,
- currentTime,
- &fail);
- /* ----------------
- * update (invalidate) our single item GetCommitTime cache.
- * ----------------
- */
- TransactionIdStore(transactionId, &cachedGetCommitTimeXid);
- cachedGetCommitTime = currentTime;
+ TransactionIdStore(transactionId, &cachedTestXid);
+ cachedTestXidStatus = status;
}
- /* ----------------
- * now we update the "last committed transaction" field
- * in the variable relation if we are recording a commit.
- * ----------------
- */
- if (RelationIsValid(VariableRelation) && status == XID_COMMIT)
- UpdateLastCommittedXid(transactionId);
-}
-
-/* --------------------------------
- * TransactionIdGetCommitTime
- * --------------------------------
- */
-
-AbsoluteTime /* commit time of transaction id */
-TransactionIdGetCommitTime(TransactionId transactionId) /* transaction id to
- * test */
-{
- BlockNumber blockNumber;
- AbsoluteTime commitTime; /* commit time */
- bool fail = false; /* success/failure */
-
- /* ----------------
- * return invalid if we aren't running yet...
- * ----------------
- */
- if (!RelationIsValid(TimeRelation))
- return INVALID_ABSTIME;
-
- /* ----------------
- * before going to the buffer manager, check our single
- * item cache to see if we didn't just get the commit time
- * a moment ago.
- * ----------------
- */
- if (TransactionIdEquals(transactionId, cachedGetCommitTimeXid))
- return cachedGetCommitTime;
-
- /* ----------------
- * compute the item pointer corresponding to the
- * page containing our transaction commit time
- * ----------------
- */
- TransComputeBlockNumber(TimeRelation, transactionId, &blockNumber);
- commitTime = TransBlockNumberGetCommitTime(TimeRelation,
- blockNumber,
- transactionId,
- &fail);
-
- /* ----------------
- * update our cache and return the transaction commit time
- * ----------------
- */
- if (!fail)
- {
- TransactionIdStore(transactionId, &cachedGetCommitTimeXid);
- cachedGetCommitTime = commitTime;
- return commitTime;
- }
- else
- return INVALID_ABSTIME;
}
/* ----------------------------------------------------------------
InitializeTransactionLog(void)
{
Relation logRelation;
- Relation timeRelation;
MemoryContext oldContext;
/* ----------------
* ----------------
*/
logRelation = heap_openr(LogRelationName);
- timeRelation = heap_openr(TimeRelationName);
VariableRelation = heap_openr(VariableRelationName);
/* ----------------
* XXX TransactionLogUpdate requires that LogRelation
- * and TimeRelation are valid so we temporarily set
- * them so we can initialize things properly.
- * This could be done cleaner.
+ * is valid so we temporarily set it so we can initialize
+ * things properly. This could be done cleaner.
* ----------------
*/
LogRelation = logRelation;
- TimeRelation = timeRelation;
/* ----------------
- * if we have a virgin database, we initialize the log and time
+ * if we have a virgin database, we initialize the log
* relation by committing the AmiTransactionId (id 512) and we
* initialize the variable relation by setting the next available
* transaction id to FirstTransactionId (id 514). OID initialization
/* ----------------
* SOMEDAY initialize the information stored in
- * the headers of the log/time/variable relations.
+ * the headers of the log/variable relations.
* ----------------
*/
TransactionLogUpdate(AmiTransactionId, XID_COMMIT);
+ TransactionIdStore(AmiTransactionId, &cachedTestXid);
+ cachedTestXidStatus = XID_COMMIT;
VariableRelationPutNextXid(FirstTransactionId);
}
TransRecover(logRelation);
}
LogRelation = (Relation) NULL;
- TimeRelation = (Relation) NULL;
SpinRelease(OidGenLockId);
/* ----------------
* ----------------
*/
LogRelation = logRelation;
- TimeRelation = timeRelation;
/* ----------------
* restore the memory context to the previous context
if (AMI_OVERRIDE)
return;
- /*
- * Within TransactionLogUpdate we call UpdateLastCommited() which
- * assumes we have exclusive access to pg_variable. Therefore we need
- * to get exclusive access before calling TransactionLogUpdate. -mer
- * 18 Aug 1992
- */
- SpinAcquire(OidGenLockId);
TransactionLogUpdate(transactionId, XID_COMMIT);
- SpinRelease(OidGenLockId);
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.13 1997/09/08 21:41:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.14 1997/11/02 15:24:44 vadim Exp $
*
* NOTES
* This file contains support functions for the high
#include <access/xact.h>
#include <storage/lmgr.h>
-static AbsoluteTime
-TransBlockGetCommitTime(Block tblock,
- TransactionId transactionId);
static XidStatus
TransBlockGetXidStatus(Block tblock,
TransactionId transactionId);
static void
-TransBlockSetCommitTime(Block tblock,
- TransactionId transactionId, AbsoluteTime commitTime);
-static void
TransBlockSetXidStatus(Block tblock,
TransactionId transactionId, XidStatus xstatus);
*/
if (relation == LogRelation)
itemsPerBlock = TP_NumXidStatusPerBlock;
- else if (relation == TimeRelation)
- itemsPerBlock = TP_NumTimePerBlock;
else
elog(WARN, "TransComputeBlockNumber: unknown relation");
bits8 bit2;
BitIndex offset;
- /* ----------------
- * sanity check
- * ----------------
- */
- if (tblock == NULL)
- {
- return XID_INVALID;
- }
-
/* ----------------
* calculate the index into the transaction data where
* our transaction status is located
Index index;
BitIndex offset;
- /* ----------------
- * sanity check
- * ----------------
- */
- if (tblock == NULL)
- return;
-
/* ----------------
* calculate the index into the transaction data where
* we sould store our transaction status.
}
}
-/* --------------------------------
- * TransBlockGetCommitTime
- *
- * This returns the transaction commit time for the
- * specified transaction id in the trans block.
- * --------------------------------
- */
-static AbsoluteTime
-TransBlockGetCommitTime(Block tblock,
- TransactionId transactionId)
-{
- Index index;
- AbsoluteTime *timeArray;
-
- /* ----------------
- * sanity check
- * ----------------
- */
- if (tblock == NULL)
- return INVALID_ABSTIME;
-
- /* ----------------
- * calculate the index into the transaction data where
- * our transaction commit time is located
- *
- * XXX this will be replaced soon when we move to the
- * new transaction id scheme -cim 3/23/90
- *
- * The new scheme is here. -mer 5/24/92
- * ----------------
- */
- index = transactionId % TP_NumTimePerBlock;
-
- /* ----------------
- * return the commit time to the caller
- * ----------------
- */
- timeArray = (AbsoluteTime *) tblock;
- return (AbsoluteTime)
- timeArray[index];
-}
-
-/* --------------------------------
- * TransBlockSetCommitTime
- *
- * This sets the commit time of the specified transaction
- * --------------------------------
- */
-static void
-TransBlockSetCommitTime(Block tblock,
- TransactionId transactionId,
- AbsoluteTime commitTime)
-{
- Index index;
- AbsoluteTime *timeArray;
-
- /* ----------------
- * sanity check
- * ----------------
- */
- if (tblock == NULL)
- return;
-
-
- /* ----------------
- * calculate the index into the transaction data where
- * we sould store our transaction status.
- *
- * XXX this will be replaced soon when we move to the
- * new transaction id scheme -cim 3/23/90
- *
- * The new scheme is here. -mer 5/24/92
- * ----------------
- */
- index = transactionId % TP_NumTimePerBlock;
-
- /* ----------------
- * store the transaction commit time at the specified index
- * ----------------
- */
- timeArray = (AbsoluteTime *) tblock;
- timeArray[index] = commitTime;
-}
-
/* ----------------------------------------------------------------
* transam i/o support routines
* ----------------------------------------------------------------
RelationUnsetLockForWrite(relation);
}
-/* --------------------------------
- * TransBlockNumberGetCommitTime
- * --------------------------------
- */
-AbsoluteTime
-TransBlockNumberGetCommitTime(Relation relation,
- BlockNumber blockNumber,
- TransactionId xid,
- bool *failP)
-{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing commit time */
- bool localfail; /* bool used if failP = NULL */
- AbsoluteTime xtime; /* commit time */
-
- /* ----------------
- * SOMEDAY place a read lock on the time relation
- *
- * That someday is today 5 Aug. 1991 -mer
- * ----------------
- */
- RelationSetLockForRead(relation);
-
- /* ----------------
- * get the block containing the transaction information
- * ----------------
- */
- buffer = ReadBuffer(relation, blockNumber);
- block = BufferGetBlock(buffer);
-
- /* ----------------
- * get the commit time from the block
- * note, for now we always return false in failP.
- * ----------------
- */
- if (failP == NULL)
- failP = &localfail;
- (*failP) = false;
-
- xtime = TransBlockGetCommitTime(block, xid);
-
- /* ----------------
- * release the buffer and return the commit time
- * ----------------
- */
- ReleaseBuffer(buffer);
-
- /* ----------------
- * SOMEDAY release our lock on the time relation
- * ----------------
- */
- RelationUnsetLockForRead(relation);
-
- if ((*failP) == false)
- return xtime;
- else
- return INVALID_ABSTIME;
-
-}
-
-/* --------------------------------
- * TransBlockNumberSetCommitTime
- * --------------------------------
- */
-void
-TransBlockNumberSetCommitTime(Relation relation,
- BlockNumber blockNumber,
- TransactionId xid,
- AbsoluteTime xtime,
- bool *failP)
-{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing commit time */
- bool localfail; /* bool used if failP = NULL */
-
- /* ----------------
- * SOMEDAY gain exclusive access to the time relation
- *
- * That someday is today 5 Aug. 1991 -mer
- * ----------------
- */
- RelationSetLockForWrite(relation);
-
- /* ----------------
- * get the block containing our commit time
- * ----------------
- */
- buffer = ReadBuffer(relation, blockNumber);
- block = BufferGetBlock(buffer);
-
- /* ----------------
- * attempt to update the commit time of the transaction on the block.
- * if we are successful, write the block. otherwise release the buffer.
- * note, for now we always return false in failP.
- * ----------------
- */
- if (failP == NULL)
- failP = &localfail;
- (*failP) = false;
-
- TransBlockSetCommitTime(block, xid, xtime);
-
- if ((*failP) == false)
- WriteBuffer(buffer);
- else
- ReleaseBuffer(buffer);
-
- /* ----------------
- * SOMEDAY release our lock on the time relation
- * ----------------
- */
- RelationUnsetLockForWrite(relation);
-
-}
-
/* --------------------------------
* TransGetLastRecordedTransaction
* --------------------------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.12 1997/09/08 21:41:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.13 1997/11/02 15:24:45 vadim Exp $
*
*-------------------------------------------------------------------------
*/
static void GetNewObjectIdBlock(Oid *oid_return, int oid_block_size);
static void VariableRelationGetNextOid(Oid *oid_return);
static void VariableRelationGetNextXid(TransactionId *xidP);
-static void VariableRelationPutLastXid(TransactionId xid);
static void VariableRelationPutNextOid(Oid *oidP);
-static void VariableRelationGetLastXid(TransactionId *xidP);
/* ---------------------
* spin lock for oid generation
ReleaseBuffer(buf);
}
-/* --------------------------------
- * VariableRelationGetLastXid
- * --------------------------------
- */
-static void
-VariableRelationGetLastXid(TransactionId *xidP)
-{
- Buffer buf;
- VariableRelationContents var;
-
- /* ----------------
- * We assume that a spinlock has been acquire to guarantee
- * exclusive access to the variable relation.
- * ----------------
- */
-
- /* ----------------
- * do nothing before things are initialized
- * ----------------
- */
- if (!RelationIsValid(VariableRelation))
- return;
-
- /* ----------------
- * read the variable page, get the the lastXid field and
- * release the buffer
- * ----------------
- */
- buf = ReadBuffer(VariableRelation, 0);
-
- if (!BufferIsValid(buf))
- {
- SpinRelease(OidGenLockId);
- elog(WARN, "VariableRelationGetNextXid: ReadBuffer failed");
- }
-
- var = (VariableRelationContents) BufferGetBlock(buf);
-
- TransactionIdStore(var->lastXidData, xidP);
-
- ReleaseBuffer(buf);
-}
-
/* --------------------------------
* VariableRelationPutNextXid
* --------------------------------
SetBufferWriteMode(flushmode);
}
-/* --------------------------------
- * VariableRelationPutLastXid
- * --------------------------------
- */
-static void
-VariableRelationPutLastXid(TransactionId xid)
-{
- Buffer buf;
- VariableRelationContents var;
-
- /* ----------------
- * We assume that a spinlock has been acquire to guarantee
- * exclusive access to the variable relation.
- * ----------------
- */
-
- /* ----------------
- * do nothing before things are initialized
- * ----------------
- */
- if (!RelationIsValid(VariableRelation))
- return;
-
- /* ----------------
- * read the variable page, update the lastXid field and
- * force the page back out to disk.
- * ----------------
- */
- buf = ReadBuffer(VariableRelation, 0);
-
- if (!BufferIsValid(buf))
- {
- SpinRelease(OidGenLockId);
- elog(WARN, "VariableRelationPutLastXid: ReadBuffer failed");
- }
-
- var = (VariableRelationContents) BufferGetBlock(buf);
-
- TransactionIdStore(xid, &(var->lastXidData));
-
- WriteBuffer(buf);
-}
-
/* --------------------------------
* VariableRelationGetNextOid
* --------------------------------
prefetched_xid_count--;
}
-/* ----------------
- * UpdateLastCommittedXid
- * ----------------
- */
-
-void
-UpdateLastCommittedXid(TransactionId xid)
-{
- TransactionId lastid;
-
-
- /*
- * we assume that spinlock OidGenLockId has been acquired prior to
- * entering this function
- */
-
- /* ----------------
- * get the "last committed" transaction id from
- * the variable relation page.
- * ----------------
- */
- VariableRelationGetLastXid(&lastid);
-
- /* ----------------
- * if the transaction id is greater than the last committed
- * transaction then we update the last committed transaction
- * in the variable relation.
- * ----------------
- */
- if (TransactionIdIsLessThan(lastid, xid))
- VariableRelationPutLastXid(xid);
-
-}
-
/* ----------------------------------------------------------------
* object id generation support
* ----------------------------------------------------------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.16 1997/09/08 21:41:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.17 1997/11/02 15:24:46 vadim Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
if (CurrentTransactionStateData.commandId == FirstCommandId)
{
CommandIdCounterOverflowFlag = true;
- elog(WARN, "You may only have 65535 commands per transaction");
+ elog(WARN, "You may only have 2^32-1 commands per transaction");
}
CurrentTransactionStateData.scanCommandId =
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.10 1997/09/08 21:41:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.11 1997/11/02 15:24:47 vadim Exp $
*
* OLD COMMENTS
* XXX WARNING
extern TransactionId AmiTransactionId;
extern TransactionId FirstTransactionId;
-/* ----------------------------------------------------------------
- * TransactionIdIsValid
- *
- * Macro-ize me.
- * ----------------------------------------------------------------
- */
-bool
-TransactionIdIsValid(TransactionId transactionId)
-{
- return ((bool) (transactionId != NullTransactionId));
-}
-
/* XXX char16 name for catalogs */
TransactionId
xidin(char *representation)
}
-/* ----------------------------------------------------------------
- * StoreInvalidTransactionId
- *
- * Maybe do away with Pointer types in these routines.
- * Macro-ize this one.
- * ----------------------------------------------------------------
- */
-void
-StoreInvalidTransactionId(TransactionId *destination)
-{
- *destination = NullTransactionId;
-}
-
-/* ----------------------------------------------------------------
- * TransactionIdStore
- *
- * Macro-ize this one.
- * ----------------------------------------------------------------
- */
-void
-TransactionIdStore(TransactionId transactionId,
- TransactionId *destination)
-{
- *destination = transactionId;
-}
-
/* ----------------------------------------------------------------
* TransactionIdEquals
* ----------------------------------------------------------------
# Makefile for catalog
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.2 1996/11/03 23:26:58 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.3 1997/11/02 15:24:52 vadim Exp $
#
#-------------------------------------------------------------------------
GLOBALBKI_SRCS= $(addprefix ../../include/catalog/, \
pg_database.h pg_demon.h pg_magic.h pg_defaults.h \
pg_variable.h pg_server.h pg_user.h pg_hosts.h \
- pg_group.h pg_log.h pg_time.h \
+ pg_group.h pg_log.h \
)
LOCALBKI_SRCS= $(addprefix ../../include/catalog/, \
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.29 1997/09/18 20:20:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.30 1997/11/02 15:24:55 vadim Exp $
*
* INTERFACE ROUTINES
* heap_creatr() - Create an uncataloged heap relation
static FormData_pg_attribute a4 = {
0xffffffff, {"cmin"}, 29l, 0l, sizeof(CommandId),
- MinCommandIdAttributeNumber, 0, -1, '\001', '\0', 's', '\0', '\0'
+ MinCommandIdAttributeNumber, 0, -1, '\001', '\0', 'i', '\0', '\0'
};
static FormData_pg_attribute a5 = {
static FormData_pg_attribute a6 = {
0xffffffff, {"cmax"}, 29l, 0l, sizeof(CommandId),
- MaxCommandIdAttributeNumber, 0, -1, '\001', '\0', 's', '\0', '\0'
-};
-
-static FormData_pg_attribute a7 = {
- 0xffffffff, {"chain"}, 27l, 0l, sizeof(ItemPointerData),
- ChainItemPointerAttributeNumber, 0, -1, '\0', '\0', 'i', '\0', '\0'
-};
-
-static FormData_pg_attribute a8 = {
- 0xffffffff, {"anchor"}, 27l, 0l, sizeof(ItemPointerData),
- AnchorItemPointerAttributeNumber, 0, -1, '\0', '\0', 'i', '\0', '\0'
-};
-
-static FormData_pg_attribute a9 = {
- 0xffffffff, {"tmin"}, 702l, 0l, sizeof(AbsoluteTime),
- MinAbsoluteTimeAttributeNumber, 0, -1, '\001', '\0', 'i', '\0', '\0'
-};
-
-static FormData_pg_attribute a10 = {
- 0xffffffff, {"tmax"}, 702l, 0l, sizeof(AbsoluteTime),
- MaxAbsoluteTimeAttributeNumber, 0, -1, '\001', '\0', 'i', '\0', '\0'
-};
-
-static FormData_pg_attribute a11 = {
- 0xffffffff, {"vtype"}, 18l, 0l, sizeof(char),
- VersionTypeAttributeNumber, 0, -1, '\001', '\0', 'c', '\0', '\0'
+ MaxCommandIdAttributeNumber, 0, -1, '\001', '\0', 'i', '\0', '\0'
};
static AttributeTupleForm HeapAtt[] =
-{&a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9, &a10, &a11};
+{&a1, &a2, &a3, &a4, &a5, &a6};
/* ----------------------------------------------------------------
* XXX END OF UGLY HARD CODED BADNESS XXX
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.24 1997/10/27 11:52:43 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.25 1997/11/02 15:25:01 vadim Exp $
*
*
* INTERFACE ROUTINES
{0l, {"ctid"}, 27l, 0l, 6, -1, 0, -1, '\0', '\0', 'i', '\0', '\0'},
{0l, {"oid"}, 26l, 0l, 4, -2, 0, -1, '\001', '\0', 'i', '\0', '\0'},
{0l, {"xmin"}, 28l, 0l, 4, -3, 0, -1, '\0', '\0', 'i', '\0', '\0'},
- {0l, {"cmin"}, 29l, 0l, 2, -4, 0, -1, '\001', '\0', 's', '\0', '\0'},
+ {0l, {"cmin"}, 29l, 0l, 4, -4, 0, -1, '\001', '\0', 'i', '\0', '\0'},
{0l, {"xmax"}, 28l, 0l, 4, -5, 0, -1, '\0', '\0', 'i', '\0', '\0'},
- {0l, {"cmax"}, 29l, 0l, 2, -6, 0, -1, '\001', '\0', 's', '\0', '\0'},
- {0l, {"chain"}, 27l, 0l, 6, -7, 0, -1, '\0', '\0', 'i', '\0', '\0'},
- {0l, {"anchor"}, 27l, 0l, 6, -8, 0, -1, '\0', '\0', 'i', '\0', '\0'},
- {0l, {"tmin"}, 702l, 0l, 4, -9, 0, -1, '\001', '\0', 'i', '\0', '\0'},
- {0l, {"tmax"}, 702l, 0l, 4, -10, 0, -1, '\001', '\0', 'i', '\0', '\0'},
- {0l, {"vtype"}, 18l, 0l, 1, -11, 0, -1, '\001', '\0', 'c', '\0', '\0'},
+ {0l, {"cmax"}, 29l, 0l, 4, -6, 0, -1, '\001', '\0', 'i', '\0', '\0'},
};
/* ----------------------------------------------------------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.48 1997/09/22 07:12:33 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.49 1997/11/02 15:25:07 vadim Exp $
*
*-------------------------------------------------------------------------
*/
htup = (HeapTuple) PageGetItem(page, itemid);
tupgone = false;
- if (!AbsoluteTimeIsBackwardCompatiblyValid(htup->t_tmin) &&
- TransactionIdIsValid((TransactionId) htup->t_xmin))
+ if (!(htup->t_infomask & HEAP_XMIN_COMMITTED))
{
-
- if (TransactionIdDidAbort(htup->t_xmin))
- {
+ if (htup->t_infomask & HEAP_XMIN_INVALID)
tupgone = true;
- }
- else if (TransactionIdDidCommit(htup->t_xmin))
- {
- htup->t_tmin = TransactionIdGetCommitTime(htup->t_xmin);
- pgchanged = true;
- }
- else if (!TransactionIdIsInProgress(htup->t_xmin))
- {
-
- /*
- * Not Aborted, Not Committed, Not in Progress - so it
- * from crashed process. - vadim 11/26/96
- */
- ncrash++;
- tupgone = true;
- }
else
{
- elog(NOTICE, "Rel %s: TID %u/%u: InsertTransactionInProgress %u - can't shrink relation",
- relname, blkno, offnum, htup->t_xmin);
- do_shrinking = false;
+ if (TransactionIdDidAbort(htup->t_xmin))
+ tupgone = true;
+ else if (TransactionIdDidCommit(htup->t_xmin))
+ {
+ htup->t_infomask |= HEAP_XMIN_COMMITTED;
+ pgchanged = true;
+ }
+ else if (!TransactionIdIsInProgress(htup->t_xmin))
+ {
+ /*
+ * Not Aborted, Not Committed, Not in Progress -
+ * so it's from crashed process. - vadim 11/26/96
+ */
+ ncrash++;
+ tupgone = true;
+ }
+ else
+ {
+ elog(NOTICE, "Rel %s: TID %u/%u: InsertTransactionInProgress %u - can't shrink relation",
+ relname, blkno, offnum, htup->t_xmin);
+ do_shrinking = false;
+ }
}
}
- if (TransactionIdIsValid((TransactionId) htup->t_xmax))
+ /*
+ * here we are concerned about tuples with xmin committed
+ * and xmax unknown or committed
+ */
+ if (htup->t_infomask & HEAP_XMIN_COMMITTED &&
+ !(htup->t_infomask & HEAP_XMAX_INVALID))
{
- if (TransactionIdDidAbort(htup->t_xmax))
+ if (htup->t_infomask & HEAP_XMAX_COMMITTED)
+ tupgone = true;
+ else if (TransactionIdDidAbort(htup->t_xmax))
{
- StoreInvalidTransactionId(&(htup->t_xmax));
+ htup->t_infomask |= HEAP_XMAX_INVALID;
pgchanged = true;
}
else if (TransactionIdDidCommit(htup->t_xmax))
tupgone = true;
else if (!TransactionIdIsInProgress(htup->t_xmax))
{
-
/*
* Not Aborted, Not Committed, Not in Progress - so it
* from crashed process. - vadim 06/02/97
*/
- StoreInvalidTransactionId(&(htup->t_xmax));
+ htup->t_infomask |= HEAP_XMAX_INVALID;;
pgchanged = true;
}
else
}
}
- /*
- * Is it possible at all ? - vadim 11/26/96
- */
- if (!TransactionIdIsValid((TransactionId) htup->t_xmin))
- {
- elog(NOTICE, "Rel %s: TID %u/%u: INSERT_TRANSACTION_ID IS INVALID. \
-DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
- relname, blkno, offnum,
- TransactionIdIsValid((TransactionId) htup->t_xmax),
- tupgone);
- }
-
/*
* It's possibly! But from where it comes ? And should we fix
* it ? - vadim 11/28/96
{
TransactionId myXID;
CommandId myCID;
- AbsoluteTime myCTM = 0;
Buffer buf,
ToBuf;
int nblocks,
TransactionIdStore(myXID, &(newtup->t_xmin));
newtup->t_cmin = myCID;
StoreInvalidTransactionId(&(newtup->t_xmax));
- newtup->t_tmin = INVALID_ABSTIME;
- newtup->t_tmax = CURRENT_ABSTIME;
- ItemPointerSetInvalid(&newtup->t_chain);
+ /* set xmin to unknown and xmax to invalid */
+ newtup->t_infomask &= ~(HEAP_XACT_MASK);
+ newtup->t_infomask |= HEAP_XMAX_INVALID;
/* add tuple to the page */
newoff = PageAddItem(ToPage, (Item) newtup, tlen,
/* now logically delete end-tuple */
TransactionIdStore(myXID, &(htup->t_xmax));
htup->t_cmax = myCID;
- memmove((char *) &(htup->t_chain), (char *) &(newtup->t_ctid), sizeof(newtup->t_ctid));
+ /* set xmax to unknown */
+ htup->t_infomask &= ~(HEAP_XMAX_INVALID | HEAP_XMAX_COMMITTED);
ToVpd->vpd_nusd++;
nmoved++;
FlushBufferPool(!TransactionFlushEnabled());
TransactionIdCommit(myXID);
FlushBufferPool(!TransactionFlushEnabled());
- myCTM = TransactionIdGetCommitTime(myXID);
}
/*
- * Clean uncleaned reapped pages from Vvpl list and set commit' times
+ * Clean uncleaned reapped pages from Vvpl list and set xmin committed
* for inserted tuples
*/
nchkmvd = 0;
htup = (HeapTuple) PageGetItem(page, itemid);
if (TransactionIdEquals((TransactionId) htup->t_xmin, myXID))
{
- htup->t_tmin = myCTM;
+ htup->t_infomask |= HEAP_XMIN_COMMITTED;
ntups++;
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.13 1997/09/19 06:52:49 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.14 1997/11/02 15:25:11 vadim Exp $
*
*-------------------------------------------------------------------------
*/
newnode->relname = pstrdup(from->relname);
if (from->refname)
newnode->refname = pstrdup(from->refname);
- if (from->timeRange)
- {
- newnode->timeRange = makeNode(TimeRange);
- if (from->timeRange->startDate)
- newnode->timeRange->startDate = pstrdup(from->timeRange->startDate);
- else
- newnode->timeRange->startDate = NULL;
- if (from->timeRange->endDate)
- newnode->timeRange->endDate = pstrdup(from->timeRange->endDate);
- else
- newnode->timeRange->endDate = NULL;
- newnode->timeQual = makeTimeRange(newnode->timeRange->startDate,
- newnode->timeRange->endDate,
- ((newnode->timeRange->endDate == NULL) ? 0 : 1));
- }
+ newnode->timeRange = NULL;
+ newnode->timeQual = NULL;
return newnode;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.28 1997/09/18 20:21:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.29 1997/11/02 15:25:19 vadim Exp $
*
*-------------------------------------------------------------------------
*/
{
"cmax", MaxCommandIdAttributeNumber
},
- {
- "chain", ChainItemPointerAttributeNumber
- },
- {
- "anchor", AnchorItemPointerAttributeNumber
- },
- {
- "tmin", MinAbsoluteTimeAttributeNumber
- },
- {
- "tmax", MaxAbsoluteTimeAttributeNumber
- },
- {
- "vtype", VersionTypeAttributeNumber
- }
};
#define SPECIALS (sizeof(special_attr)/sizeof(*special_attr))
"cid",
"xid",
"cid",
- "tid",
- "tid",
- "abstime",
- "abstime",
- "char"
};
#define MAXFARGS 8 /* max # args to a c or postquel function */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.61 1997/10/31 00:50:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.62 1997/11/02 15:25:26 vadim Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
$$ = makeNode(TimeRange);
$$->startDate = $2;
$$->endDate = $4;
+ elog (WARN, "parser: TimeRange is not supported");
}
| '[' date ']'
{
$$ = makeNode(TimeRange);
$$->startDate = $2;
$$->endDate = NULL;
+ elog (WARN, "parser: TimeRange is not supported");
}
;
/* disallow refs to magic system tables */
if (strcmp(LogRelationName, $1) == 0
|| strcmp(VariableRelationName, $1) == 0
- || strcmp(TimeRelationName, $1) == 0
|| strcmp(MagicRelationName, $1) == 0)
elog(WARN,"%s cannot be accessed by users",$1);
else
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.21 1997/09/08 21:46:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.22 1997/11/02 15:25:30 vadim Exp $
*
*-------------------------------------------------------------------------
*/
return (te_head);
}
-TimeQual
-makeTimeRange(char *datestring1,
- char *datestring2,
- int timecode) /* 0 = snapshot , 1 = timerange */
-{
- TimeQual qual = NULL;
- AbsoluteTime t1,
- t2;
-
- switch (timecode)
- {
- case 0:
- if (datestring1 == NULL)
- {
- elog(WARN, "MakeTimeRange: bad snapshot arg");
- }
- t1 = nabstimein(datestring1);
- if (!AbsoluteTimeIsValid(t1))
- {
- elog(WARN, "bad snapshot time: \"%s\"",
- datestring1);
- }
- qual = TimeFormSnapshotTimeQual(t1);
- break;
- case 1:
- if (datestring1 == NULL)
- {
- t1 = NOSTART_ABSTIME;
- }
- else
- {
- t1 = nabstimein(datestring1);
- if (!AbsoluteTimeIsValid(t1))
- {
- elog(WARN,
- "bad range start time: \"%s\"",
- datestring1);
- }
- }
- if (datestring2 == NULL)
- {
- t2 = NOEND_ABSTIME;
- }
- else
- {
- t2 = nabstimein(datestring2);
- if (!AbsoluteTimeIsValid(t2))
- {
- elog(WARN,
- "bad range end time: \"%s\"",
- datestring2);
- }
- }
- qual = TimeFormRangedTimeQual(t1, t2);
- break;
- default:
- elog(WARN, "MakeTimeRange: internal parser error");
- }
- return qual;
-}
-
static void
disallow_setop(char *op, Type optype, Node *operand)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.14 1997/09/18 20:21:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.15 1997/11/02 15:25:36 vadim Exp $
*
*-------------------------------------------------------------------------
*/
long *PrivateRefCount; /* also used in freelist.c */
long *LastRefCount; /* refcounts of last ExecMain level */
long *CommitInfoNeedsSave;/* to write buffers where we have filled
- * in */
-
- /* t_tmin (or t_tmax) */
+ * in t_infomask */
/*
* Data Structures:
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.18 1997/09/12 04:08:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.19 1997/11/02 15:25:40 vadim Exp $
*
*-------------------------------------------------------------------------
*/
#include "access/heapam.h"
#include "access/relscan.h"
#include "access/tupdesc.h"
+#include "access/transam.h"
#include "access/xact.h"
#include "access/nbtree.h"
#include "access/tupdesc.h"
TransactionIdStore(GetCurrentTransactionId(), &(htup->t_xmax));
htup->t_cmax = GetCurrentCommandId();
+ htup->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID);
/*
* If we're overwriting the entire block, we're lucky. All we need to
ntup->t_len = tupsize;
ItemPointerSet(&(ntup->t_ctid), BufferGetBlockNumber(buffer), off);
- ItemPointerSetInvalid(&(ntup->t_chain));
LastOidProcessed = ntup->t_oid = newoid();
TransactionIdStore(GetCurrentTransactionId(), &(ntup->t_xmin));
ntup->t_cmin = GetCurrentCommandId();
StoreInvalidTransactionId(&(ntup->t_xmax));
ntup->t_cmax = 0;
- ntup->t_tmin = INVALID_ABSTIME;
- ntup->t_tmax = CURRENT_ABSTIME;
+ ntup->t_infomask = HEAP_XMAX_INVALID;
ntup->t_natts = 2;
ntup->t_hoff = hoff;
- ntup->t_vtype = 0;
- ntup->t_infomask = 0x0;
/* if a NULL is passed in, avoid the calculations below */
if (dbuf == NULL)
printf("\n\t:ctid=%s:oid=%d",
ItemPointerFormExternal(&tup->t_ctid),
tup->t_oid);
- printf(":natts=%d:thoff=%d:vtype=`%c' (0x%02x):",
+ printf(":natts=%d:thoff=%d:",
tup->t_natts,
- tup->t_hoff, tup->t_vtype, tup->t_vtype);
+ tup->t_hoff);
- printf("\n\t:tmin=%d:cmin=%u:",
- tup->t_tmin, tup->t_cmin);
+ printf("\n\t:cmin=%u:",
+ tup->t_cmin);
printf("xmin=%u:", tup->t_xmin);
- printf("\n\t:tmax=%d:cmax=%u:",
- tup->t_tmax, tup->t_cmax);
+ printf("\n\t:cmax=%u:",
+ tup->t_cmax);
- printf("xmax=%u:", tup->t_xmax);
+ printf("xmax=%u:\n", tup->t_xmax);
- printf("\n\t:chain=%s:\n",
- ItemPointerFormExternal(&tup->t_chain));
} else
putchar('\n');
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.50 1997/10/25 01:10:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.51 1997/11/02 15:25:45 vadim Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
querytree_list = new_list;
- /* ----------------
- * Fix time range quals
- * this _must_ go here, because it must take place after rewrites
- * ( if they take place ) so that time quals are usable by the executor
- *
- * Also, need to frob the range table entries here to plan union
- * queries for archived relations.
- * ----------------
- */
- for (i = 0; i < querytree_list->len; i++)
- {
- List *l;
- List *rt = NULL;
-
- querytree = querytree_list->qtrees[i];
-
- /* ----------------
- * utilities don't have time ranges
- * ----------------
- */
- if (querytree->commandType == CMD_UTILITY)
- continue;
-
- rt = querytree->rtable;
-
- foreach(l, rt)
- {
- RangeTblEntry *rte = lfirst(l);
- TimeRange *timequal = rte->timeRange;
-
- if (timequal)
- {
- int timecode = (rte->timeRange->endDate == NULL) ? 0 : 1;
-
- rte->timeQual = makeTimeRange(rte->timeRange->startDate,
- rte->timeRange->endDate,
- timecode);
- }
- else
- {
- rte->timeQual = NULL;
- }
- }
-
- /* check for archived relations */
- plan_archive(rt);
- }
-
if (DebugPrintRewrittenParsetree == true)
{
printf("\n---- \tafter rewriting:\n");
if (IsUnderPostmaster == false)
{
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.50 $ $Date: 1997/10/25 01:10:16 $");
+ puts("$Revision: 1.51 $ $Date: 1997/11/02 15:25:45 $");
}
/* ----------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.13 1997/10/25 05:12:38 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.14 1997/11/02 15:25:57 vadim Exp $
*
*-------------------------------------------------------------------------
*/
char *result;
CommandId c2;
- /*
- * cid is a number between 0 .. 2^16-1, therefore we need at most 6
- * chars for the string (5 digits + '\0') NOTE: print it as an
- * UNSIGNED int!
- */
- result = palloc(6);
+ result = palloc(12);
c2 = (CommandId) c;
sprintf(result, "%u", (unsigned) (c2));
return (result);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.26 1997/10/25 05:38:52 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.27 1997/11/02 15:26:06 vadim Exp $
*
*-------------------------------------------------------------------------
*/
#include "catalog/pg_variable.h"
#include "catalog/pg_log.h"
-#include "catalog/pg_time.h"
#include "catalog/pg_attrdef.h"
#include "catalog/pg_relcheck.h"
#include "catalog/indexing.h"
FormData_pg_attribute Desc_pg_type[Natts_pg_type] = {Schema_pg_type};
FormData_pg_attribute Desc_pg_variable[Natts_pg_variable] = {Schema_pg_variable};
FormData_pg_attribute Desc_pg_log[Natts_pg_log] = {Schema_pg_log};
-FormData_pg_attribute Desc_pg_time[Natts_pg_time] = {Schema_pg_time};
/* ----------------
* global variables
formrdesc(TypeRelationName, Natts_pg_type, Desc_pg_type);
formrdesc(VariableRelationName, Natts_pg_variable, Desc_pg_variable);
formrdesc(LogRelationName, Natts_pg_log, Desc_pg_log);
- formrdesc(TimeRelationName, Natts_pg_time, Desc_pg_time);
/*
* If this isn't initdb time, then we want to initialize some index
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.14 1997/09/18 14:33:46 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.15 1997/11/02 15:26:12 vadim Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
LogRelationName,
MagicRelationName,
ServerRelationName,
- TimeRelationName,
UserRelationName,
VariableRelationName,
0
/*-------------------------------------------------------------------------
*
* tqual.c--
- * POSTGRES time qualification code.
+ * POSTGRES "time" qualification code.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.8 1997/09/12 04:08:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.9 1997/11/02 15:26:17 vadim Exp $
*
*-------------------------------------------------------------------------
*/
#include "access/transam.h"
#include "utils/elog.h"
#include "utils/palloc.h"
-#include "utils/nabstime.h"
#include "utils/tqual.h"
-static AbsoluteTime TimeQualGetEndTime(TimeQual qual);
-static AbsoluteTime TimeQualGetSnapshotTime(TimeQual qual);
-static AbsoluteTime TimeQualGetStartTime(TimeQual qual);
-static bool TimeQualIncludesNow(TimeQual qual);
-static bool TimeQualIndicatesDisableValidityChecking(TimeQual qual);
-static bool TimeQualIsLegal(TimeQual qual);
-#ifndef NO_ASSERT_CHECKING
-static bool TimeQualIsRanged(TimeQual qual);
-static bool TimeQualIsValid(TimeQual qual);
-#endif
-static bool TimeQualIsSnapshot(TimeQual qual);
-
-/*
- * TimeQualMode --
- * Mode indicator for treatment of time qualifications.
- */
-typedef uint16 TimeQualMode;
-
-#define TimeQualAt 0x1
-#define TimeQualNewer 0x2
-#define TimeQualOlder 0x4
-#define TimeQualAll 0x8
-
-#define TimeQualMask 0xf
-
-#define TimeQualEvery 0x0
-#define TimeQualRange (TimeQualNewer | TimeQualOlder)
-#define TimeQualAllAt (TimeQualAt | TimeQualAll)
-
-typedef struct TimeQualData
-{
- AbsoluteTime start;
- AbsoluteTime end;
- TimeQualMode mode;
-} TimeQualData;
-
-typedef TimeQualData *InternalTimeQual;
-
-static TimeQualData SelfTimeQualData;
-TimeQual SelfTimeQual = (Pointer) &SelfTimeQualData;
+static int4 SelfTimeQualData;
+TimeQual SelfTimeQual = (TimeQual) &SelfTimeQualData;
extern bool PostgresIsInitialized;
static bool HeapTupleSatisfiesItself(HeapTuple tuple);
static bool HeapTupleSatisfiesNow(HeapTuple tuple);
-static bool
-HeapTupleSatisfiesSnapshotInternalTimeQual(HeapTuple tuple,
- InternalTimeQual qual);
-static bool
-HeapTupleSatisfiesUpperBoundedInternalTimeQual(HeapTuple tuple,
- InternalTimeQual qual);
-static bool
-HeapTupleSatisfiesUpperUnboundedInternalTimeQual(HeapTuple tuple,
- InternalTimeQual qual);
-
-
-
-/*
- * TimeQualIsValid --
- * True iff time qualification is valid.
- */
-#ifndef NO_ASSERT_CHECKING
-static bool
-TimeQualIsValid(TimeQual qual)
-{
- bool hasStartTime;
-
- if (!PointerIsValid(qual) || qual == SelfTimeQual)
- {
- return (true);
- }
-
- if (((InternalTimeQual) qual)->mode & ~TimeQualMask)
- {
- return (false);
- }
-
- if (((InternalTimeQual) qual)->mode & TimeQualAt)
- {
- return (AbsoluteTimeIsBackwardCompatiblyValid(((InternalTimeQual) qual)->start));
- }
-
- hasStartTime = false;
-
- if (((InternalTimeQual) qual)->mode & TimeQualNewer)
- {
- if (!AbsoluteTimeIsBackwardCompatiblyValid(((InternalTimeQual) qual)->start))
- {
- return (false);
- }
- hasStartTime = true;
- }
-
- if (((InternalTimeQual) qual)->mode & TimeQualOlder)
- {
- if (!AbsoluteTimeIsBackwardCompatiblyValid(((InternalTimeQual) qual)->end))
- {
- return (false);
- }
- if (hasStartTime)
- {
- return ((bool) !AbsoluteTimeIsBefore(
- ((InternalTimeQual) qual)->end,
- ((InternalTimeQual) qual)->start));
- }
- }
- return (true);
-}
-#endif
-
-/*
- * TimeQualIsLegal --
- * True iff time qualification is legal.
- * I.e., true iff time qualification does not intersects the future,
- * relative to the transaction start time.
- *
- * Note:
- * Assumes time qualification is valid.
- */
-static bool
-TimeQualIsLegal(TimeQual qual)
-{
- Assert(TimeQualIsValid(qual));
-
- if (qual == NowTimeQual || qual == SelfTimeQual)
- {
- return (true);
- }
-
- /* TimeQualAt */
- if (((InternalTimeQual) qual)->mode & TimeQualAt)
- {
- AbsoluteTime a,
- b;
-
- a = ((InternalTimeQual) qual)->start;
- b = GetCurrentTransactionStartTime();
-
- if (AbsoluteTimeIsAfter(a, b))
- return (false);
- else
- return (true);
- }
-
- /* TimeQualOlder or TimeQualRange */
- if (((InternalTimeQual) qual)->mode & TimeQualOlder)
- {
- AbsoluteTime a,
- b;
-
- a = ((InternalTimeQual) qual)->end;
- b = GetCurrentTransactionStartTime();
-
- if (AbsoluteTimeIsAfter(a, b))
- return (false);
- else
- return (true);
- }
-
- /* TimeQualNewer */
- if (((InternalTimeQual) qual)->mode & TimeQualNewer)
- {
- AbsoluteTime a,
- b;
-
- a = ((InternalTimeQual) qual)->start;
- b = GetCurrentTransactionStartTime();
-
- if (AbsoluteTimeIsAfter(a, b))
- return (false);
- else
- return (true);
- }
-
- /* TimeQualEvery */
- return (true);
-}
-
-/*
- * TimeQualIncludesNow --
- * True iff time qualification includes "now."
- *
- * Note:
- * Assumes time qualification is valid.
- */
-static bool
-TimeQualIncludesNow(TimeQual qual)
-{
- Assert(TimeQualIsValid(qual));
-
- if (qual == NowTimeQual || qual == SelfTimeQual)
- {
- return (true);
- }
-
- if (((InternalTimeQual) qual)->mode & TimeQualAt)
- {
- return (false);
- }
- if (((InternalTimeQual) qual)->mode & TimeQualOlder &&
- !AbsoluteTimeIsAfter(
- ((InternalTimeQual) qual)->end,
- GetCurrentTransactionStartTime()))
- {
-
- return (false);
- }
- return (true);
-}
-
-/*
- * TimeQualIncludesPast --
- * True iff time qualification includes some time in the past.
- *
- * Note:
- * Assumes time qualification is valid.
- * XXX may not be needed?
- */
-#ifdef NOT_USED
-bool
-TimeQualIncludesPast(TimeQual qual)
-{
- Assert(TimeQualIsValid(qual));
-
- if (qual == NowTimeQual || qual == SelfTimeQual)
- {
- return (false);
- }
-
- /* otherwise, must check archive (setting locks as appropriate) */
- return (true);
-}
-
-#endif
-
-/*
- * TimeQualIsSnapshot --
- * True iff time qualification is a snapshot qualification.
- *
- * Note:
- * Assumes time qualification is valid.
- */
-static bool
-TimeQualIsSnapshot(TimeQual qual)
-{
- Assert(TimeQualIsValid(qual));
-
- if (qual == NowTimeQual || qual == SelfTimeQual)
- {
- return (false);
- }
-
- return ((bool) !!(((InternalTimeQual) qual)->mode & TimeQualAt));
-}
-
-/*
- * TimeQualIsRanged --
- * True iff time qualification is a ranged qualification.
- *
- * Note:
- * Assumes time qualification is valid.
- */
-#ifndef NO_ASSERT_CHECKING
-static bool
-TimeQualIsRanged(TimeQual qual)
-{
- Assert(TimeQualIsValid(qual));
-
- if (qual == NowTimeQual || qual == SelfTimeQual)
- {
- return (false);
- }
-
- return ((bool) !(((InternalTimeQual) qual)->mode & TimeQualAt));
-}
-#endif
-
-/*
- * TimeQualIndicatesDisableValidityChecking --
- * True iff time qualification indicates validity checking should be
- * disabled.
- *
- * Note:
- * XXX This should not be implemented since this does not make sense.
- */
-static bool
-TimeQualIndicatesDisableValidityChecking(TimeQual qual)
-{
- Assert(TimeQualIsValid(qual));
-
- if (qual == NowTimeQual || qual == SelfTimeQual)
- {
- return (false);
- }
-
- if (((InternalTimeQual) qual)->mode & TimeQualAll)
- {
- return (true);
- }
- return (false);
-}
-
-/*
- * TimeQualGetSnapshotTime --
- * Returns time for a snapshot time qual.
- *
- * Note:
- * Assumes time qual is valid snapshot time qual.
- */
-static AbsoluteTime
-TimeQualGetSnapshotTime(TimeQual qual)
-{
- Assert(TimeQualIsSnapshot(qual));
-
- return (((InternalTimeQual) qual)->start);
-}
-
-/*
- * TimeQualGetStartTime --
- * Returns start time for a ranged time qual.
- *
- * Note:
- * Assumes time qual is valid ranged time qual.
- */
-static AbsoluteTime
-TimeQualGetStartTime(TimeQual qual)
-{
- Assert(TimeQualIsRanged(qual));
-
- return (((InternalTimeQual) qual)->start);
-}
-
-/*
- * TimeQualGetEndTime --
- * Returns end time for a ranged time qual.
- *
- * Note:
- * Assumes time qual is valid ranged time qual.
- */
-static AbsoluteTime
-TimeQualGetEndTime(TimeQual qual)
-{
- Assert(TimeQualIsRanged(qual));
-
- return (((InternalTimeQual) qual)->end);
-}
-
-/*
- * TimeFormSnapshotTimeQual --
- * Returns snapshot time qual for a time.
- *
- * Note:
- * Assumes time is valid.
- */
-TimeQual
-TimeFormSnapshotTimeQual(AbsoluteTime time)
-{
- InternalTimeQual qual;
-
- Assert(AbsoluteTimeIsBackwardCompatiblyValid(time));
-
- qual = (InternalTimeQual) palloc(sizeof *qual);
-
- qual->start = time;
- qual->end = INVALID_ABSTIME;
- qual->mode = TimeQualAt;
-
- return ((TimeQual) qual);
-}
-
-/*
- * TimeFormRangedTimeQual --
- * Returns ranged time qual for a pair of times.
- *
- * Note:
- * If start time is invalid, it is regarded as the epoch.
- * If end time is invalid, it is regarded as "now."
- * Assumes start time is before (or the same as) end time.
- */
-TimeQual
-TimeFormRangedTimeQual(AbsoluteTime startTime,
- AbsoluteTime endTime)
-{
- InternalTimeQual qual;
-
- qual = (InternalTimeQual) palloc(sizeof *qual);
-
- qual->start = startTime;
- qual->end = endTime;
- qual->mode = TimeQualEvery;
-
- if (AbsoluteTimeIsBackwardCompatiblyValid(startTime))
- {
- qual->mode |= TimeQualNewer;
- }
- if (AbsoluteTimeIsBackwardCompatiblyValid(endTime))
- {
- qual->mode |= TimeQualOlder;
- }
-
- return ((TimeQual) qual);
-}
/*
* HeapTupleSatisfiesTimeQual --
* Note:
* Assumes heap tuple is valid.
* Assumes time qual is valid.
- * XXX Many of the checks may be simplified and still remain correct.
- * XXX Partial answers to the checks may be cached in an ItemId.
*/
bool
HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual)
{
-/* extern TransactionId AmiTransactionId; */
-
- Assert(HeapTupleIsValid(tuple));
- Assert(TimeQualIsValid(qual));
if (TransactionIdEquals(tuple->t_xmax, AmiTransactionId))
return (false);
return (HeapTupleSatisfiesNow(tuple));
}
- if (!TimeQualIsLegal(qual))
- {
- elog(WARN, "HeapTupleSatisfiesTimeQual: illegal time qual");
- }
-
- if (TimeQualIndicatesDisableValidityChecking(qual))
- {
- elog(WARN, "HeapTupleSatisfiesTimeQual: no disabled validity checking (yet)");
- }
-
- if (TimeQualIsSnapshot(qual))
- {
- return (HeapTupleSatisfiesSnapshotInternalTimeQual(tuple,
- (InternalTimeQual) qual));
- }
-
- if (TimeQualIncludesNow(qual))
- {
- return (HeapTupleSatisfiesUpperUnboundedInternalTimeQual(tuple,
- (InternalTimeQual) qual));
- }
+ elog(WARN, "HeapTupleSatisfiesTimeQual: illegal time qual");
- return (HeapTupleSatisfiesUpperBoundedInternalTimeQual(tuple,
- (InternalTimeQual) qual));
+ return (false);
}
/*
HeapTupleSatisfiesItself(HeapTuple tuple)
{
- /*
- * XXX Several evil casts are made in this routine. Casting XID to be
- * TransactionId works only because TransactionId->data is the first
- * (and only) field of the structure.
- */
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tuple->t_tmin))
+ if (!(tuple->t_infomask & HEAP_XMIN_COMMITTED))
{
- if (TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmin) &&
- !TransactionIdIsValid((TransactionId) tuple->t_xmax))
+ if (tuple->t_infomask & HEAP_XMIN_INVALID) /* xid invalid or aborted */
+ return (false);
+
+ if (TransactionIdIsCurrentTransactionId(tuple->t_xmin))
{
- return (true);
+ if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid */
+ return (true);
+ else
+ return (false);
}
- if (!TransactionIdDidCommit((TransactionId) tuple->t_xmin))
+ if (!TransactionIdDidCommit(tuple->t_xmin))
{
+ if (TransactionIdDidAbort(tuple->t_xmin))
+ tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
return (false);
}
- tuple->t_tmin = TransactionIdGetCommitTime(tuple->t_xmin);
+ tuple->t_infomask |= HEAP_XMIN_COMMITTED;
}
/* the tuple was inserted validly */
- if (AbsoluteTimeIsBackwardCompatiblyReal(tuple->t_tmax))
- {
- return (false);
- }
-
- if (!TransactionIdIsValid((TransactionId) tuple->t_xmax))
- {
+ if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid or aborted */
return (true);
- }
- if (TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmax))
- {
+ if (tuple->t_infomask & HEAP_XMAX_COMMITTED)
+ return (false);
+
+ if (TransactionIdIsCurrentTransactionId(tuple->t_xmax))
return (false);
- }
- if (!TransactionIdDidCommit((TransactionId) tuple->t_xmax))
+ if (!TransactionIdDidCommit(tuple->t_xmax))
{
+ if (TransactionIdDidAbort(tuple->t_xmax))
+ tuple->t_infomask |= HEAP_XMAX_INVALID; /* aborted */
return (true);
}
/* by here, deleting transaction has committed */
- tuple->t_tmax = TransactionIdGetCommitTime(tuple->t_xmax);
+ tuple->t_infomask |= HEAP_XMAX_COMMITTED;
return (false);
}
*/
if (!PostgresIsInitialized)
- return ((bool) (TransactionIdIsValid((TransactionId) tuple->t_xmin) &&
- !TransactionIdIsValid((TransactionId) tuple->t_xmax)));
+ return ((bool) (TransactionIdIsValid(tuple->t_xmin) &&
+ !TransactionIdIsValid(tuple->t_xmax)));
- /*
- * XXX Several evil casts are made in this routine. Casting XID to be
- * TransactionId works only because TransactionId->data is the first
- * (and only) field of the structure.
- */
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tuple->t_tmin))
+ if (!(tuple->t_infomask & HEAP_XMIN_COMMITTED))
{
-
- if (TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmin)
- && CommandIdGEScanCommandId(tuple->t_cmin))
- {
-
+ if (tuple->t_infomask & HEAP_XMIN_INVALID) /* xid invalid or aborted */
return (false);
- }
- if (TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmin)
- && !CommandIdGEScanCommandId(tuple->t_cmin))
+ if (TransactionIdIsCurrentTransactionId(tuple->t_xmin))
{
+ if (CommandIdGEScanCommandId(tuple->t_cmin))
+ return (false); /* inserted after scan started */
- if (!TransactionIdIsValid((TransactionId) tuple->t_xmax))
- {
+ if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid */
return (true);
- }
- Assert(TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmax));
+ Assert(TransactionIdIsCurrentTransactionId(tuple->t_xmax));
if (CommandIdGEScanCommandId(tuple->t_cmax))
- {
- return (true);
- }
+ return (true); /* deleted after scan started */
+ else
+ return (false); /* deleted before scan started */
}
/*
* this call is VERY expensive - requires a log table lookup.
*/
- if (!TransactionIdDidCommit((TransactionId) tuple->t_xmin))
+ if (!TransactionIdDidCommit(tuple->t_xmin))
{
+ if (TransactionIdDidAbort(tuple->t_xmin))
+ tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
return (false);
}
- /*
- * the transaction has been committed--store the commit time _now_
- * instead of waiting for a vacuum so we avoid the expensive call
- * next time.
- */
- tuple->t_tmin = TransactionIdGetCommitTime(tuple->t_xmin);
+ tuple->t_infomask |= HEAP_XMIN_COMMITTED;
}
/* by here, the inserting transaction has committed */
- if (!TransactionIdIsValid((TransactionId) tuple->t_xmax))
- {
- return (true);
- }
- if (TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmax))
- {
- return (false);
- }
-
- if (AbsoluteTimeIsBackwardCompatiblyReal(tuple->t_tmax))
- {
- return (false);
- }
-
- if (!TransactionIdDidCommit((TransactionId) tuple->t_xmax))
- {
+ if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid or aborted */
return (true);
- }
-
- /* xmax transaction committed, but no tmax set. so set it. */
- tuple->t_tmax = TransactionIdGetCommitTime(tuple->t_xmax);
-
- return (false);
-}
-
-/*
- * HeapTupleSatisfiesSnapshotInternalTimeQual --
- * True iff heap tuple is valid at the snapshot time qualification.
- *
- * Note:
- * Assumes heap tuple is valid.
- * Assumes internal time qualification is valid snapshot qualification.
- */
-/*
- * The satisfaction of Rel[T] requires the following:
- *
- * (Xmin is committed && Tmin <= T &&
- * (Xmax is null || (Xmax is not committed && Xmax != my-transaction) ||
- * Tmax >= T))
- */
-static bool
-HeapTupleSatisfiesSnapshotInternalTimeQual(HeapTuple tuple,
- InternalTimeQual qual)
-{
-
- /*
- * XXX Several evil casts are made in this routine. Casting XID to be
- * TransactionId works only because TransactionId->data is the first
- * (and only) field of the structure.
- */
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tuple->t_tmin))
- {
-
- if (!TransactionIdDidCommit((TransactionId) tuple->t_xmin))
- {
- return (false);
- }
-
- tuple->t_tmin = TransactionIdGetCommitTime(tuple->t_xmin);
- }
- if (AbsoluteTimeIsBefore(TimeQualGetSnapshotTime((TimeQual) qual), tuple->t_tmin))
- {
- return (false);
- }
- /* the tuple was inserted validly before the snapshot time */
-
- if (!AbsoluteTimeIsBackwardCompatiblyReal(tuple->t_tmax))
- {
-
- if (!TransactionIdIsValid((TransactionId) tuple->t_xmax) ||
- !TransactionIdDidCommit((TransactionId) tuple->t_xmax))
- {
-
- return (true);
- }
-
- tuple->t_tmax = TransactionIdGetCommitTime(tuple->t_xmax);
- }
-
- return ((bool)
- AbsoluteTimeIsAfter(tuple->t_tmax,
- TimeQualGetSnapshotTime((TimeQual) qual)));
-}
-
-/*
- * HeapTupleSatisfiesUpperBoundedInternalTimeQual --
- * True iff heap tuple is valid within a upper bounded time qualification.
- *
- * Note:
- * Assumes heap tuple is valid.
- * Assumes time qualification is valid ranged qualification with fixed
- * upper bound.
- */
-/*
- * The satisfaction of [T1,T2] requires the following:
- *
- * (Xmin is committed && Tmin <= T2 &&
- * (Xmax is null || (Xmax is not committed && Xmax != my-transaction) ||
- * T1 is null || Tmax >= T1))
- */
-static bool
-HeapTupleSatisfiesUpperBoundedInternalTimeQual(HeapTuple tuple,
- InternalTimeQual qual)
-{
-
- /*
- * XXX Several evil casts are made in this routine. Casting XID to be
- * TransactionId works only because TransactionId->data is the first
- * (and only) field of the structure.
- */
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tuple->t_tmin))
- {
-
- if (!TransactionIdDidCommit((TransactionId) tuple->t_xmin))
- {
- return (false);
- }
-
- tuple->t_tmin = TransactionIdGetCommitTime(tuple->t_xmin);
- }
-
- if (AbsoluteTimeIsBefore(TimeQualGetEndTime((TimeQual) qual), tuple->t_tmin))
- {
+ if (tuple->t_infomask & HEAP_XMAX_COMMITTED)
return (false);
- }
- /* the tuple was inserted validly before the range end */
-
- if (!AbsoluteTimeIsBackwardCompatiblyValid(TimeQualGetStartTime((TimeQual) qual)))
- {
- return (true);
- }
- if (!AbsoluteTimeIsBackwardCompatiblyReal(tuple->t_tmax))
+ if (TransactionIdIsCurrentTransactionId(tuple->t_xmax))
{
-
- if (!TransactionIdIsValid((TransactionId) tuple->t_xmax) ||
- !TransactionIdDidCommit((TransactionId) tuple->t_xmax))
- {
-
- return (true);
- }
-
- tuple->t_tmax = TransactionIdGetCommitTime(tuple->t_xmax);
- }
-
- return ((bool) AbsoluteTimeIsAfter(tuple->t_tmax,
- TimeQualGetStartTime((TimeQual) qual)));
-}
-
-/*
- * HeapTupleSatisfiesUpperUnboundedInternalTimeQual --
- * True iff heap tuple is valid within a upper bounded time qualification.
- *
- * Note:
- * Assumes heap tuple is valid.
- * Assumes time qualification is valid ranged qualification with no
- * upper bound.
- */
-/*
- * The satisfaction of [T1,] requires the following:
- *
- * ((Xmin == my-transaction && Cmin != my-command &&
- * (Xmax is null || (Xmax == my-transaction && Cmax != my-command)))
- * ||
- *
- * (Xmin is committed &&
- * (Xmax is null || (Xmax == my-transaction && Cmax == my-command) ||
- * (Xmax is not committed && Xmax != my-transaction) ||
- * T1 is null || Tmax >= T1)))
- */
-static bool
-HeapTupleSatisfiesUpperUnboundedInternalTimeQual(HeapTuple tuple,
- InternalTimeQual qual)
-{
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tuple->t_tmin))
- {
-
- if (TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmin) &&
- CommandIdGEScanCommandId(tuple->t_cmin))
- {
-
- return (false);
- }
-
- if (TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmin) &&
- !CommandIdGEScanCommandId(tuple->t_cmin))
- {
-
- if (!TransactionIdIsValid((TransactionId) tuple->t_xmax))
- {
- return (true);
- }
-
- Assert(TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmax));
-
- return ((bool) !CommandIdGEScanCommandId(tuple->t_cmax));
- }
-
- if (!TransactionIdDidCommit((TransactionId) tuple->t_xmin))
- {
- return (false);
- }
-
- tuple->t_tmin = TransactionIdGetCommitTime(tuple->t_xmin);
+ if (CommandIdGEScanCommandId(tuple->t_cmax))
+ return (true); /* deleted after scan started */
+ else
+ return (false); /* deleted before scan started */
}
- /* the tuple was inserted validly */
- if (!AbsoluteTimeIsBackwardCompatiblyValid(TimeQualGetStartTime((TimeQual) qual)))
+ if (!TransactionIdDidCommit(tuple->t_xmax))
{
+ if (TransactionIdDidAbort(tuple->t_xmax))
+ tuple->t_infomask |= HEAP_XMAX_INVALID; /* aborted */
return (true);
}
- if (!AbsoluteTimeIsBackwardCompatiblyReal(tuple->t_tmax))
- {
+ /* xmax transaction committed */
+ tuple->t_infomask |= HEAP_XMAX_COMMITTED;
- if (!TransactionIdIsValid((TransactionId) tuple->t_xmax))
- {
- return (true);
- }
-
- if (TransactionIdIsCurrentTransactionId((TransactionId) tuple->t_xmax))
- {
- return (CommandIdGEScanCommandId(tuple->t_cmin));
- /* it looks like error ^^^^ */
- }
-
- if (!TransactionIdDidCommit((TransactionId) tuple->t_xmax))
- {
- return (true);
- }
-
- tuple->t_tmax = TransactionIdGetCommitTime(tuple->t_xmax);
- }
-
- return ((bool) AbsoluteTimeIsAfter(tuple->t_tmax,
- TimeQualGetStartTime((TimeQual) qual)));
+ return (false);
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.20 1997/10/30 23:37:01 momjian Exp $
+ * $Id: heapam.h,v 1.21 1997/11/02 15:26:37 vadim Exp $
*
*-------------------------------------------------------------------------
*/
extern Size ComputeDataSize(TupleDesc tupleDesc, Datum value[], char nulls[]);
extern void
DataFill(char *data, TupleDesc tupleDesc,
- Datum value[], char nulls[], char *infomask,
+ Datum value[], char nulls[], uint16 *infomask,
bits8 *bit);
extern int heap_attisnull(HeapTuple tup, int attnum);
extern int heap_sysattrlen(AttrNumber attno);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: htup.h,v 1.6 1997/09/08 21:50:46 momjian Exp $
+ * $Id: htup.h,v 1.7 1997/11/02 15:26:42 vadim Exp $
*
*-------------------------------------------------------------------------
*/
*/
typedef struct HeapTupleData
{
+ unsigned int t_len; /* length of entire tuple */
- unsigned int t_len; /* length of entire tuple */
+ Oid t_oid; /* OID of this tuple -- 4 bytes */
- ItemPointerData t_ctid; /* current TID of this tuple */
+ CommandId t_cmin; /* insert CID stamp -- 4 bytes each */
+ CommandId t_cmax; /* delete CommandId stamp */
- ItemPointerData t_chain; /* replaced tuple TID */
+ TransactionId t_xmin; /* insert XID stamp -- 4 bytes each */
+ TransactionId t_xmax; /* delete XID stamp */
- Oid t_oid; /* OID of this tuple -- 4 bytes */
+ ItemPointerData t_ctid; /* current TID of this tuple */
+
+ int16 t_natts; /* number of attributes */
- CommandId t_cmin; /* insert CID stamp -- 2 bytes each */
- CommandId t_cmax; /* delete CommandId stamp */
+ uint16 t_infomask; /* various infos */
- TransactionId t_xmin; /* insert XID stamp -- 4 bytes each */
- TransactionId t_xmax; /* delete XID stamp */
+ uint8 t_hoff; /* sizeof tuple header */
- AbsoluteTime t_tmin; /* time stamps -- 4 bytes each */
- AbsoluteTime t_tmax;
-
- int16 t_natts; /* number of attributes */
- char t_vtype; /* not used - padding */
-
- char t_infomask; /* whether tuple as null or variable
- * length attributes */
-
- uint8 t_hoff; /* sizeof tuple header */
-
- bits8 t_bits[MinHeapTupleBitmapSize / 8];
+ bits8 t_bits[MinHeapTupleBitmapSize / 8];
/* bit map of domains */
/* MORE DATA FOLLOWS AT END OF STRUCT */
#define MinCommandIdAttributeNumber (-4)
#define MaxTransactionIdAttributeNumber (-5)
#define MaxCommandIdAttributeNumber (-6)
-#define ChainItemPointerAttributeNumber (-7)
-#define AnchorItemPointerAttributeNumber (-8)
-#define MinAbsoluteTimeAttributeNumber (-9)
-#define MaxAbsoluteTimeAttributeNumber (-10)
-#define VersionTypeAttributeNumber (-11)
-#define FirstLowInvalidHeapAttributeNumber (-12)
+#define FirstLowInvalidHeapAttributeNumber (-7)
/* ----------------
/*
* information stored in t_infomask:
*/
-#define HEAP_HASNULL 0x01 /* has null attribute(s) */
-#define HEAP_HASVARLENA 0x02 /* has variable length
+#define HEAP_HASNULL 0x0001 /* has null attribute(s) */
+#define HEAP_HASVARLENA 0x0002 /* has variable length
* attribute(s) */
+#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */
+#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */
+#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */
+#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */
+
+#define HEAP_XACT_MASK 0x0F00 /* */
#define HeapTupleNoNulls(tuple) \
(!(((HeapTuple) (tuple))->t_infomask & HEAP_HASNULL))
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: transam.h,v 1.11 1997/09/08 21:51:03 momjian Exp $
+ * $Id: transam.h,v 1.12 1997/11/02 15:26:44 vadim Exp $
*
* NOTES
* Transaction System Version 101 now support proper oid
#define TRANSAM_H
#include <storage/bufmgr.h>
-#include <utils/nabstime.h>
/* ----------------
* transaction system version id
* even if their minor versions differ.
* ----------------
*/
-#define TRANS_SYSTEM_VERSION 101
+#define TRANS_SYSTEM_VERSION 200
/* ----------------
* transaction id status values
*
- * someday we will use "11" = 3 = XID_INVALID to mean the
- * starting of run-length encoded log data.
+ * someday we will use "11" = 3 = XID_COMMIT_CHILD to mean the
+ * commiting of child xactions.
* ----------------
*/
-#define XID_COMMIT 2 /* transaction commited */
-#define XID_ABORT 1 /* transaction aborted */
-#define XID_INPROGRESS 0 /* transaction in progress */
-#define XID_INVALID 3 /* other */
+#define XID_COMMIT 2 /* transaction commited */
+#define XID_ABORT 1 /* transaction aborted */
+#define XID_INPROGRESS 0 /* transaction in progress */
+#define XID_COMMIT_CHILD 3 /* child xact commited */
typedef unsigned char XidStatus;/* (2 bits) */
*/
#define TP_DataSize BLCKSZ
#define TP_NumXidStatusPerBlock (TP_DataSize * 4)
-#define TP_NumTimePerBlock (TP_DataSize / 4)
/* ----------------
* LogRelationContents structure
typedef LogRelationContentsData *LogRelationContents;
-/* ----------------
- * TimeRelationContents structure
- *
- * This structure describes the storage of the data in the
- * first 2048 bytes of the time relation. This storage is never
- * used for transaction commit times because transaction id's begin
- * their numbering at 512.
- *
- * The first 4 bytes of this relation store the version
- * number of the transction system.
- * ----------------
- */
-typedef struct TimeRelationContentsData
-{
- int TransSystemVersion;
-} TimeRelationContentsData;
-
-typedef TimeRelationContentsData *TimeRelationContents;
-
/* ----------------
* VariableRelationContents structure
*
*/
typedef struct VariableRelationContentsData
{
- int TransSystemVersion;
- TransactionId nextXidData;
- TransactionId lastXidData;
- Oid nextOid;
+ int TransSystemVersion;
+ TransactionId nextXidData;
+ TransactionId lastXidData; /* unused */
+ Oid nextOid;
} VariableRelationContentsData;
typedef VariableRelationContentsData *VariableRelationContents;
/*
* prototypes for functions in transam/transam.c
*/
-extern AbsoluteTime TransactionIdGetCommitTime(TransactionId transactionId);
extern void InitializeTransactionLog(void);
extern bool TransactionIdDidCommit(TransactionId transactionId);
extern bool TransactionIdDidAbort(TransactionId transactionId);
TransBlockNumberSetXidStatus(Relation relation,
BlockNumber blockNumber, TransactionId xid, XidStatus xstatus,
bool *failP);
-extern AbsoluteTime
-TransBlockNumberGetCommitTime(Relation relation,
- BlockNumber blockNumber, TransactionId xid, bool *failP);
-extern void
-TransBlockNumberSetCommitTime(Relation relation,
- BlockNumber blockNumber, TransactionId xid, AbsoluteTime xtime,
- bool *failP);
/* in transam/varsup.c */
extern void VariableRelationPutNextXid(TransactionId xid);
extern void GetNewTransactionId(TransactionId *xid);
-extern void UpdateLastCommittedXid(TransactionId xid);
extern void GetNewObjectId(Oid *oid_return);
extern void CheckMaxObjectId(Oid assigned_oid);
/* in transam.c */
extern Relation LogRelation;
-extern Relation TimeRelation;
extern Relation VariableRelation;
-extern TransactionId cachedGetCommitTimeXid;
-extern AbsoluteTime cachedGetCommitTime;
extern TransactionId cachedTestXid;
extern XidStatus cachedTestXidStatus;
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: valid.h,v 1.8 1997/09/18 14:20:45 momjian Exp $
+ * $Id: valid.h,v 1.9 1997/11/02 15:26:46 vadim Exp $
*
*-------------------------------------------------------------------------
*/
/* We use underscores to protect the variable passed in as parameters */ \
HeapTuple _tuple; \
bool _res; \
- TransactionId _old_tmin, \
- _old_tmax; \
\
if (!ItemIdIsUsed(itemId)) \
(result) = (HeapTuple) NULL; \
(result) = _tuple; \
else \
{ \
- _old_tmin = _tuple->t_tmin; \
- _old_tmax = _tuple->t_tmax; \
+ uint16 _infomask = _tuple->t_infomask; \
+ \
_res = HeapTupleSatisfiesTimeQual(_tuple, (qual)); \
- if (_tuple->t_tmin != _old_tmin || \
- _tuple->t_tmax != _old_tmax) \
+ if (_tuple->t_infomask != _infomask) \
SetBufferCommitInfoNeedsSave(buffer); \
if (_res) \
(result) = _tuple; \
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: xact.h,v 1.9 1997/09/08 21:51:06 momjian Exp $
+ * $Id: xact.h,v 1.10 1997/11/02 15:26:48 vadim Exp $
*
*-------------------------------------------------------------------------
*/
typedef TransactionStateData *TransactionState;
+#define TransactionIdIsValid(xid) ((bool) (xid != NullTransactionId))
+#define TransactionIdStore(xid, dest) \
+ (*((TransactionId*)dest) = (TransactionId)xid)
+#define StoreInvalidTransactionId(dest) \
+ (*((TransactionId*)dest) = NullTransactionId)
+
/* ----------------
* extern definitions
* ----------------
extern TransactionId xidin(char *representation);
extern char *xidout(TransactionId transactionId);
extern bool xideq(TransactionId xid1, TransactionId xid2);
-extern bool TransactionIdIsValid(TransactionId transactionId);
-extern void StoreInvalidTransactionId(TransactionId *destination);
-extern void
-TransactionIdStore(TransactionId transactionId,
- TransactionId *destination);
extern bool TransactionIdEquals(TransactionId id1, TransactionId id2);
extern bool TransactionIdIsLessThan(TransactionId id1, TransactionId id2);
extern void TransactionIdAdd(TransactionId *xid, int value);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: catname.h,v 1.6 1997/09/08 02:34:47 momjian Exp $
+ * $Id: catname.h,v 1.7 1997/11/02 15:26:50 vadim Exp $
*
*-------------------------------------------------------------------------
*/
#define RewriteRelationName "pg_rewrite"
#define ServerRelationName "pg_server"
#define StatisticRelationName "pg_statistic"
-#define TimeRelationName "pg_time"
#define TypeRelationName "pg_type"
#define UserRelationName "pg_user"
#define VariableRelationName "pg_variable"
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_attribute.h,v 1.16 1997/09/08 02:35:02 momjian Exp $
+ * $Id: pg_attribute.h,v 1.17 1997/11/02 15:26:56 vadim Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
DATA(insert OID = 0 ( 1247 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1247 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1247 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1247 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1247 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1247 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1247 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_database
DATA(insert OID = 0 ( 1262 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1262 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1262 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1262 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1262 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1262 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1262 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1262 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1262 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_demon
DATA(insert OID = 0 ( 1251 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1251 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1251 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1251 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1251 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1251 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1251 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1251 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1251 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1251 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1251 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1251 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_proc
DATA(insert OID = 0 ( 1255 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1255 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1255 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1255 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1255 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1255 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1255 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_server
DATA(insert OID = 0 ( 1257 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1257 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1257 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1257 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1257 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1257 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1257 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1257 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1257 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1257 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1257 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1257 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1257 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_user
DATA(insert OID = 0 ( 1260 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1260 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1260 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1260 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1260 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1260 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1260 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1260 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1260 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_group
DATA(insert OID = 0 ( 1261 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1261 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1261 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1261 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1261 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1261 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1261 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1261 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1261 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_attribute
DATA(insert OID = 0 ( 1249 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1249 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1249 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1249 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1249 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1249 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1249 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1249 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1249 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_class
DATA(insert OID = 0 ( 1259 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1259 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1259 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1259 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1259 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1259 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1259 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_magic
DATA(insert OID = 0 ( 1253 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1253 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1253 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1253 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1253 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1253 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1253 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1253 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1253 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1253 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1253 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1253 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1253 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_defaults
DATA(insert OID = 0 ( 1263 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1263 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1263 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1263 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1263 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1263 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1263 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1263 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1263 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1263 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1263 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1263 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1263 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_attrdef
DATA(insert OID = 0 ( 1215 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1215 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1215 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1215 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1215 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1215 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1215 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1215 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1215 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_relcheck
DATA(insert OID = 0 ( 1216 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1216 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1216 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1216 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1216 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1216 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1216 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1216 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1216 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_trigger
DATA(insert OID = 0 ( 1219 ctid 27 0 6 -1 0 -1 f f i f f));
DATA(insert OID = 0 ( 1219 oid 26 0 4 -2 0 -1 t f i f f));
DATA(insert OID = 0 ( 1219 xmin 28 0 4 -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 cmin 29 0 2 -4 0 -1 t f s f f));
+DATA(insert OID = 0 ( 1219 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1219 xmax 28 0 4 -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 cmax 29 0 2 -6 0 -1 t f s f f));
-DATA(insert OID = 0 ( 1219 chain 27 0 6 -7 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 anchor 27 0 6 -8 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 tmin 702 0 4 -9 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1219 tmax 702 0 4 -10 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1219 vtype 18 0 1 -11 0 -1 t f c f f));
+DATA(insert OID = 0 ( 1219 cmax 29 0 4 -6 0 -1 t f i f f));
/* ----------------
* pg_hosts - this relation is used to store host based authentication
DATA(insert OID = 0 ( 1269 logfoo 26 0 4 1 0 -1 t f i f f));
-/* ----------------
- * pg_time - this relation is modified by special purpose access
- * method code. The following is garbage but is needed
- * so that the reldesc code works properly.
- * ----------------
- */
-#define Schema_pg_time \
-{ 1271l, {"timefoo"}, 26l, 0l, 4, 1, 0l, -1l, '\001', '\0', 'i', '\0', '\0' }
-
-DATA(insert OID = 0 ( 1271 timefoo 26 0 4 1 0 -1 t f i f f));
-
#endif /* PG_ATTRIBUTE_H */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_class.h,v 1.11 1997/09/08 02:35:03 momjian Exp $
+ * $Id: pg_class.h,v 1.12 1997/11/02 15:26:59 vadim Exp $
*
* NOTES
* ``pg_relation'' is being replaced by ``pg_class''. currently
DATA(insert OID = 1263 ( pg_defaults 89 PGUID 0 0 0 0 0 f t r n 2 0 0 0 f _null_ ));
DATA(insert OID = 1264 ( pg_variable 90 PGUID 0 0 0 0 0 f t s n 2 0 0 0 f _null_ ));
DATA(insert OID = 1269 ( pg_log 99 PGUID 0 0 0 0 0 f t s n 1 0 0 0 f _null_ ));
-DATA(insert OID = 1271 ( pg_time 100 PGUID 0 0 0 0 0 f t s n 1 0 0 0 f _null_ ));
DATA(insert OID = 1273 ( pg_hosts 101 PGUID 0 0 0 0 0 f t s n 3 0 0 0 f _null_ ));
DATA(insert OID = 1215 ( pg_attrdef 109 PGUID 0 0 0 0 0 t t r n 4 0 0 0 f _null_ ));
DATA(insert OID = 1216 ( pg_relcheck 110 PGUID 0 0 0 0 0 t t r n 4 0 0 0 f _null_ ));
#define RelOid_pg_defaults 1263
#define RelOid_pg_variable 1264
#define RelOid_pg_log 1269
-#define RelOid_pg_time 1271
#define RelOid_pg_hosts 1273
#define RelOid_pg_attrdef 1215
#define RelOid_pg_relcheck 1216
+++ /dev/null
-/*-------------------------------------------------------------------------
- *
- * pg_time.h--
- * the system commit-time relation "pg_time" is not a "heap" relation.
- * it is automatically created by the transam/ code and the
- * information here is all bogus and is just here to make the
- * relcache code happy.
- *
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- * $Id: pg_time.h,v 1.4 1997/09/08 02:35:28 momjian Exp $
- *
- * NOTES
- * The structures and macros used by the transam/ code
- * to access pg_time should some day go here -cim 6/18/90
- *
- *-------------------------------------------------------------------------
- */
-#ifndef PG_TIME_H
-#define PG_TIME_H
-
-/* ----------------
- * postgres.h contains the system type definintions and the
- * CATALOG(), BOOTSTRAP and DATA() sugar words so this file
- * can be read by both genbki.sh and the C compiler.
- * ----------------
- */
-
-CATALOG(pg_time) BOOTSTRAP
-{
- Oid timefoo;
-} FormData_pg_time;
-
-typedef FormData_pg_time *Form_pg_time;
-
-#define Natts_pg_time 1
-#define Anum_pg_time_timefoo 1
-
-
-#endif /* PG_TIME_H */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_type.h,v 1.19 1997/09/08 21:51:31 momjian Exp $
+ * $Id: pg_type.h,v 1.20 1997/11/02 15:27:03 vadim Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
DATA(insert OID = 27 ( tid PGUID 6 19 f b t \054 0 0 tidin tidout tidin tidout i _null_ ));
DATA(insert OID = 28 ( xid PGUID 4 12 t b t \054 0 0 xidin xidout xidin xidout i _null_ ));
-DATA(insert OID = 29 ( cid PGUID 2 3 t b t \054 0 0 cidin cidout cidin cidout s _null_ ));
+DATA(insert OID = 29 ( cid PGUID 4 10 t b t \054 0 0 cidin cidout cidin cidout i _null_ ));
DATA(insert OID = 30 ( oid8 PGUID 32 89 f b t \054 0 26 oid8in oid8out oid8in oid8out i _null_ ));
DATA(insert OID = 32 ( SET PGUID -1 -1 f r t \054 0 -1 textin textout textin textout i _null_ ));
/* OIDS 100 - 199 */
-DATA(insert OID = 100 ( pg_time PGUID 1 1 t b t \054 1271 0 foo bar foo bar c _null_));
DATA(insert OID = 101 ( pg_hosts PGUID 1 1 t b t \054 1273 0 foo bar foo bar c _null_));
DATA(insert OID = 109 ( pg_attrdef PGUID 1 1 t b t \054 1215 0 foo bar foo bar c _null_));
DATA(insert OID = 110 ( pg_relcheck PGUID 1 1 t b t \054 1216 0 foo bar foo bar c _null_));
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_query.h,v 1.12 1997/09/08 21:53:39 momjian Exp $
+ * $Id: parse_query.h,v 1.13 1997/11/02 15:27:08 vadim Exp $
*
*-------------------------------------------------------------------------
*/
extern List *
expandAll(ParseState *pstate, char *relname, char *refname,
int *this_resno);
-extern TimeQual
-makeTimeRange(char *datestring1, char *datestring2,
- int timecode);
extern Expr *make_op(char *opname, Node *ltree, Node *rtree);
extern Oid find_atttype(Oid relid, char *attrname);
*
* Copyright (c) 1995, Regents of the University of California
*
- * $Id: postgres.h,v 1.9 1997/09/08 21:50:28 momjian Exp $
+ * $Id: postgres.h,v 1.10 1997/11/02 15:26:28 vadim Exp $
*
*-------------------------------------------------------------------------
*/
typedef uint32 TransactionId;
#define InvalidTransactionId 0
-typedef uint16 CommandId;
+typedef uint32 CommandId;
#define FirstCommandId 0
/*-------------------------------------------------------------------------
*
* tqual.h--
- * POSTGRES time qualification definitions.
+ * POSTGRES "time" qualification definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tqual.h,v 1.9 1997/09/08 21:55:19 momjian Exp $
- *
- * NOTE
- * It may be desirable to allow time qualifications to indicate
- * relative times.
+ * $Id: tqual.h,v 1.10 1997/11/02 15:27:14 vadim Exp $
*
*-------------------------------------------------------------------------
*/
#include <access/htup.h>
-typedef struct TimeQualSpace
-{
- char data[12];
-} TimeQualSpace;
-
typedef Pointer TimeQual;
/* Tuples valid as of StartTransactionCommand */
extern void setheapoverride(bool on);
extern bool heapisoverride(void);
-extern TimeQual TimeFormSnapshotTimeQual(AbsoluteTime time);
-extern TimeQual
-TimeFormRangedTimeQual(AbsoluteTime startTime,
- AbsoluteTime endTime);
extern bool HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual);