From 32cd09ac6d467ec788f8f4181097d47bafcfaee1 Mon Sep 17 00:00:00 2001 From: "Vadim B. Mikheev" Date: Sun, 2 Nov 1997 15:27:14 +0000 Subject: [PATCH] Good Bye, Time Travel! --- src/backend/access/common/heaptuple.c | 83 +-- src/backend/access/common/indextuple.c | 4 +- src/backend/access/heap/heapam.c | 15 +- src/backend/access/transam/transam.c | 127 +--- src/backend/access/transam/transsup.c | 225 +----- src/backend/access/transam/varsup.c | 124 +--- src/backend/access/transam/xact.c | 4 +- src/backend/access/transam/xid.c | 40 +- src/backend/catalog/Makefile | 4 +- src/backend/catalog/heap.c | 33 +- src/backend/catalog/index.c | 11 +- src/backend/commands/vacuum.c | 93 ++- src/backend/nodes/copyfuncs.c | 19 +- src/backend/parser/catalog_utils.c | 22 +- src/backend/parser/gram.y | 5 +- src/backend/parser/parse_query.c | 63 +- src/backend/storage/buffer/buf_init.c | 6 +- src/backend/storage/large_object/inv_api.c | 26 +- src/backend/tcop/postgres.c | 52 +- src/backend/utils/adt/char.c | 9 +- src/backend/utils/cache/relcache.c | 5 +- src/backend/utils/init/globals.c | 3 +- src/backend/utils/time/tqual.c | 765 ++------------------- src/include/access/heapam.h | 4 +- src/include/access/htup.h | 51 +- src/include/access/transam.h | 57 +- src/include/access/valid.h | 11 +- src/include/access/xact.h | 13 +- src/include/catalog/catname.h | 3 +- src/include/catalog/pg_attribute.h | 139 +--- src/include/catalog/pg_class.h | 4 +- src/include/catalog/pg_time.h | 41 -- src/include/catalog/pg_type.h | 5 +- src/include/parser/parse_query.h | 5 +- src/include/postgres.h | 4 +- src/include/utils/tqual.h | 17 +- 36 files changed, 258 insertions(+), 1834 deletions(-) delete mode 100644 src/include/catalog/pg_time.h diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index f124e56467..263f29cb68 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -8,7 +8,7 @@ * * * 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 @@ -115,7 +115,7 @@ DataFill(char *data, TupleDesc tupleDesc, Datum value[], char nulls[], - char *infomask, + uint16 *infomask, bits8 *bit) { bits8 *bitP = 0; @@ -246,11 +246,6 @@ heap_attisnull(HeapTuple tup, int attnum) case MinCommandIdAttributeNumber: case MaxTransactionIdAttributeNumber: case MaxCommandIdAttributeNumber: - case ChainItemPointerAttributeNumber: - case AnchorItemPointerAttributeNumber: - case MinAbsoluteTimeAttributeNumber: - case MaxAbsoluteTimeAttributeNumber: - case VersionTypeAttributeNumber: break; case 0: @@ -293,18 +288,6 @@ heap_sysattrlen(AttrNumber attno) 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); @@ -343,21 +326,6 @@ heap_sysattrbyval(AttrNumber 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.", @@ -377,7 +345,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum) { switch (attnum) { - case SelfItemPointerAttributeNumber: + case SelfItemPointerAttributeNumber: return ((Datum) &tup->t_ctid); case ObjectIdAttributeNumber: return ((Datum) (long) tup->t_oid); @@ -389,38 +357,6 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum) 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); } @@ -858,8 +794,6 @@ heap_formtuple(TupleDesc tupleDescriptor, 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, @@ -868,6 +802,8 @@ heap_formtuple(TupleDesc tupleDescriptor, &tuple->t_infomask, (hasnull ? tuple->t_bits : NULL)); + tuple->t_infomask |= HEAP_XMAX_INVALID; + return (tuple); } @@ -970,9 +906,9 @@ heap_modifytuple(HeapTuple 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 */ @@ -1013,10 +949,11 @@ heap_addheader(uint32 natts, /* max domain index */ 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); diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c index 8d3fba5909..273de3b4c4 100644 --- a/src/backend/access/common/indextuple.c +++ b/src/backend/access/common/indextuple.c @@ -8,7 +8,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ index_formtuple(TupleDesc tupleDescriptor, int i; unsigned short infomask = 0; bool hasnull = false; - char tupmask = 0; + uint16 tupmask = 0; int numberOfAttributes = tupleDescriptor->natts; if (numberOfAttributes > MaxIndexAttributeNumber) diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 2537e7e777..cc173f4fe8 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -7,7 +7,7 @@ * * * 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 @@ -1174,8 +1174,8 @@ heap_insert(Relation relation, HeapTuple tup) 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); @@ -1281,7 +1281,7 @@ heap_delete(Relation relation, ItemPointer tid) */ TransactionIdStore(GetCurrentTransactionId(), &(tp->t_xmax)); tp->t_cmax = GetCurrentCommandId(); - ItemPointerSetInvalid(&tp->t_chain); + tp->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID); /* ---------------- * invalidate caches @@ -1410,9 +1410,8 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup) 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 @@ -1438,7 +1437,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup) */ 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 diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index 91c7ec8a3d..02b7fa9769 100644 --- a/src/backend/access/transam/transam.c +++ b/src/backend/access/transam/transam.c @@ -7,7 +7,7 @@ * * * 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 @@ -41,17 +41,14 @@ TransactionLogUpdate(TransactionId transactionId, */ 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 @@ -118,7 +115,7 @@ SetRecoveryCheckingEnabled(bool state) #endif /* ---------------------------------------------------------------- - * postgres log/time access method interface + * postgres log access method interface * * TransactionLogTest * TransactionLogUpdate @@ -204,7 +201,6 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */ { BlockNumber blockNumber; bool fail = false; /* success/failure */ - AbsoluteTime currentTime; /* time of this transaction */ /* ---------------- * during initialization we don't record any updates. @@ -213,12 +209,6 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */ if (!RelationIsValid(LogRelation)) return; - /* ---------------- - * get the transaction commit time - * ---------------- - */ - currentTime = getSystemTime(); - /* ---------------- * update the log relation * ---------------- @@ -234,91 +224,12 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */ * 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; } /* ---------------------------------------------------------------- @@ -472,7 +383,6 @@ void InitializeTransactionLog(void) { Relation logRelation; - Relation timeRelation; MemoryContext oldContext; /* ---------------- @@ -503,20 +413,17 @@ InitializeTransactionLog(void) * ---------------- */ 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 @@ -529,10 +436,12 @@ InitializeTransactionLog(void) /* ---------------- * 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); } @@ -547,7 +456,6 @@ InitializeTransactionLog(void) TransRecover(logRelation); } LogRelation = (Relation) NULL; - TimeRelation = (Relation) NULL; SpinRelease(OidGenLockId); /* ---------------- @@ -561,7 +469,6 @@ InitializeTransactionLog(void) * ---------------- */ LogRelation = logRelation; - TimeRelation = timeRelation; /* ---------------- * restore the memory context to the previous context @@ -651,15 +558,7 @@ TransactionIdCommit(TransactionId transactionId) 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); } /* diff --git a/src/backend/access/transam/transsup.c b/src/backend/access/transam/transsup.c index 227c47ef54..a80b769982 100644 --- a/src/backend/access/transam/transsup.c +++ b/src/backend/access/transam/transsup.c @@ -7,7 +7,7 @@ * * * 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 @@ -23,16 +23,10 @@ #include #include -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); @@ -73,8 +67,6 @@ TransComputeBlockNumber(Relation relation, /* relation to test */ */ if (relation == LogRelation) itemsPerBlock = TP_NumXidStatusPerBlock; - else if (relation == TimeRelation) - itemsPerBlock = TP_NumTimePerBlock; else elog(WARN, "TransComputeBlockNumber: unknown relation"); @@ -197,15 +189,6 @@ TransBlockGetXidStatus(Block tblock, 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 @@ -248,13 +231,6 @@ TransBlockSetXidStatus(Block tblock, Index index; BitIndex offset; - /* ---------------- - * sanity check - * ---------------- - */ - if (tblock == NULL) - return; - /* ---------------- * calculate the index into the transaction data where * we sould store our transaction status. @@ -295,90 +271,6 @@ TransBlockSetXidStatus(Block tblock, } } -/* -------------------------------- - * 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 * ---------------------------------------------------------------- @@ -494,121 +386,6 @@ TransBlockNumberSetXidStatus(Relation relation, 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 * -------------------------------- diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 7fdbfd3bcc..e082350cb6 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -7,7 +7,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -23,9 +23,7 @@ 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 @@ -80,49 +78,6 @@ VariableRelationGetNextXid(TransactionId *xidP) 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 * -------------------------------- @@ -169,49 +124,6 @@ VariableRelationPutNextXid(TransactionId xid) 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 * -------------------------------- @@ -449,40 +361,6 @@ GetNewTransactionId(TransactionId *xid) 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 * ---------------------------------------------------------------- diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index e5e1057bba..ea5f1146d8 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -7,7 +7,7 @@ * * * 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: @@ -497,7 +497,7 @@ CommandCounterIncrement() 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 = diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c index b60c6ba7ef..4a0799ac2c 100644 --- a/src/backend/access/transam/xid.c +++ b/src/backend/access/transam/xid.c @@ -7,7 +7,7 @@ * * * 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 @@ -30,18 +30,6 @@ extern TransactionId DisabledTransactionId; 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) @@ -65,32 +53,6 @@ xidout(TransactionId transactionId) } -/* ---------------------------------------------------------------- - * 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 * ---------------------------------------------------------------- diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile index e7228199cf..c2d7290753 100644 --- a/src/backend/catalog/Makefile +++ b/src/backend/catalog/Makefile @@ -4,7 +4,7 @@ # 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 $ # #------------------------------------------------------------------------- @@ -30,7 +30,7 @@ GENBKI= ./genbki.sh 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/, \ diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 6c485d112e..9dbec5ce2e 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -7,7 +7,7 @@ * * * 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 @@ -108,7 +108,7 @@ static FormData_pg_attribute a3 = { 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 = { @@ -118,36 +118,11 @@ 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 diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 454a7795cc..9ebfc53ac6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -7,7 +7,7 @@ * * * 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 @@ -119,14 +119,9 @@ static FormData_pg_attribute sysatts[] = { {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'}, }; /* ---------------------------------------------------------------- diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 3af40713b3..1ce7b0998d 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -7,7 +7,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -742,54 +742,60 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel, 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 @@ -800,18 +806,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel, } } - /* - * 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 @@ -973,7 +967,6 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel, { TransactionId myXID; CommandId myCID; - AbsoluteTime myCTM = 0; Buffer buf, ToBuf; int nblocks, @@ -1187,9 +1180,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel, 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, @@ -1209,7 +1202,8 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", /* 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++; @@ -1278,11 +1272,10 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", 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; @@ -1316,7 +1309,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", htup = (HeapTuple) PageGetItem(page, itemid); if (TransactionIdEquals((TransactionId) htup->t_xmin, myXID)) { - htup->t_tmin = myCTM; + htup->t_infomask |= HEAP_XMIN_COMMITTED; ntups++; } } diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 6b86c5fffc..4c46c03e5b 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -7,7 +7,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -1470,21 +1470,8 @@ _copyRangeTblEntry(RangeTblEntry *from) 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; } diff --git a/src/backend/parser/catalog_utils.c b/src/backend/parser/catalog_utils.c index 884dece094..e378459773 100644 --- a/src/backend/parser/catalog_utils.c +++ b/src/backend/parser/catalog_utils.c @@ -6,7 +6,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -75,21 +75,6 @@ struct { "cmax", MaxCommandIdAttributeNumber }, - { - "chain", ChainItemPointerAttributeNumber - }, - { - "anchor", AnchorItemPointerAttributeNumber - }, - { - "tmin", MinAbsoluteTimeAttributeNumber - }, - { - "tmax", MaxAbsoluteTimeAttributeNumber - }, - { - "vtype", VersionTypeAttributeNumber - } }; #define SPECIALS (sizeof(special_attr)/sizeof(*special_attr)) @@ -101,11 +86,6 @@ static char *attnum_type[SPECIALS] = { "cid", "xid", "cid", - "tid", - "tid", - "abstime", - "abstime", - "char" }; #define MAXFARGS 8 /* max # args to a c or postquel function */ diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 3b52333b66..a11fcdf664 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -10,7 +10,7 @@ * * * 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 @@ -2391,12 +2391,14 @@ time_range: '[' opt_range_start ',' opt_range_end ']' $$ = 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"); } ; @@ -3387,7 +3389,6 @@ relation_name: SpecialRuleRelation /* 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 diff --git a/src/backend/parser/parse_query.c b/src/backend/parser/parse_query.c index 088fe180f1..70f9763e02 100644 --- a/src/backend/parser/parse_query.c +++ b/src/backend/parser/parse_query.c @@ -8,7 +8,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -243,67 +243,6 @@ expandAll(ParseState *pstate, char *relname, char *refname, int *this_resno) 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) { diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c index 738ca638de..3ede3dcf59 100644 --- a/src/backend/storage/buffer/buf_init.c +++ b/src/backend/storage/buffer/buf_init.c @@ -7,7 +7,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -70,9 +70,7 @@ extern IpcSemaphoreId WaitIOSemId; 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: diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c index 337cf44e3d..7b89ad9569 100644 --- a/src/backend/storage/large_object/inv_api.c +++ b/src/backend/storage/large_object/inv_api.c @@ -8,7 +8,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,7 @@ #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" @@ -791,6 +792,7 @@ inv_wrold(LargeObjectDesc *obj_desc, 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 @@ -1005,18 +1007,14 @@ inv_newtuple(LargeObjectDesc *obj_desc, 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) @@ -1132,22 +1130,20 @@ DumpPage(Page page, int blkno) 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'); } diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index fb5adb35ab..8654c11ad8 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -7,7 +7,7 @@ * * * 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 @@ -495,54 +495,6 @@ pg_plan(char *query_string, /* string to execute */ 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"); @@ -1391,7 +1343,7 @@ PostgresMain(int argc, char *argv[]) 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 $"); } /* ---------------- diff --git a/src/backend/utils/adt/char.c b/src/backend/utils/adt/char.c index 588c052d0e..cb715cd7c7 100644 --- a/src/backend/utils/adt/char.c +++ b/src/backend/utils/adt/char.c @@ -12,7 +12,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -81,12 +81,7 @@ cidout(int32 c) 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); diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index d1c253f95c..90cb42d320 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -7,7 +7,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -80,7 +80,6 @@ #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" @@ -118,7 +117,6 @@ FormData_pg_attribute Desc_pg_proc[Natts_pg_proc] = {Schema_pg_proc}; 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 @@ -1679,7 +1677,6 @@ RelationInitialize(void) 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 diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c index 7f2aefe3d6..95e0abfd37 100644 --- a/src/backend/utils/init/globals.c +++ b/src/backend/utils/init/globals.c @@ -7,7 +7,7 @@ * * * 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 @@ -114,7 +114,6 @@ char *SharedSystemRelationNames[] = { LogRelationName, MagicRelationName, ServerRelationName, - TimeRelationName, UserRelationName, VariableRelationName, 0 diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c index aa2cd6398b..756d3efff9 100644 --- a/src/backend/utils/time/tqual.c +++ b/src/backend/utils/time/tqual.c @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * 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 $ * *------------------------------------------------------------------------- */ @@ -22,50 +22,11 @@ #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; @@ -119,363 +80,6 @@ heapisoverride() 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 -- @@ -484,16 +88,10 @@ TimeFormRangedTimeQual(AbsoluteTime startTime, * 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); @@ -508,30 +106,9 @@ HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual) 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); } /* @@ -560,50 +137,48 @@ static bool 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); } @@ -667,295 +242,69 @@ HeapTupleSatisfiesNow(HeapTuple tuple) */ 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); } diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 4621d83671..a66fcab073 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -6,7 +6,7 @@ * * 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 $ * *------------------------------------------------------------------------- */ @@ -142,7 +142,7 @@ extern void heap_restrpos(HeapScanDesc sdesc); 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); diff --git a/src/include/access/htup.h b/src/include/access/htup.h index 0b6653f386..72fb5a8d31 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -6,7 +6,7 @@ * * 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 $ * *------------------------------------------------------------------------- */ @@ -28,33 +28,25 @@ */ 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 */ @@ -69,12 +61,7 @@ typedef HeapTupleData *HeapTuple; #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) /* ---------------- @@ -101,9 +88,15 @@ typedef HeapTupleData *HeapTuple; /* * 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)) diff --git a/src/include/access/transam.h b/src/include/access/transam.h index efb6e824a7..fb4a6cd724 100644 --- a/src/include/access/transam.h +++ b/src/include/access/transam.h @@ -6,7 +6,7 @@ * * 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 @@ -18,7 +18,6 @@ #define TRANSAM_H #include -#include /* ---------------- * transaction system version id @@ -33,19 +32,19 @@ * 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) */ @@ -69,7 +68,6 @@ typedef unsigned char XidStatus;/* (2 bits) */ */ #define TP_DataSize BLCKSZ #define TP_NumXidStatusPerBlock (TP_DataSize * 4) -#define TP_NumTimePerBlock (TP_DataSize / 4) /* ---------------- * LogRelationContents structure @@ -90,25 +88,6 @@ typedef struct LogRelationContentsData 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 * @@ -127,10 +106,10 @@ typedef TimeRelationContentsData *TimeRelationContents; */ typedef struct VariableRelationContentsData { - int TransSystemVersion; - TransactionId nextXidData; - TransactionId lastXidData; - Oid nextOid; + int TransSystemVersion; + TransactionId nextXidData; + TransactionId lastXidData; /* unused */ + Oid nextOid; } VariableRelationContentsData; typedef VariableRelationContentsData *VariableRelationContents; @@ -143,7 +122,6 @@ 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); @@ -162,18 +140,10 @@ extern void 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); @@ -184,11 +154,8 @@ 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; diff --git a/src/include/access/valid.h b/src/include/access/valid.h index a37258c62a..d7707fa495 100644 --- a/src/include/access/valid.h +++ b/src/include/access/valid.h @@ -6,7 +6,7 @@ * * 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 $ * *------------------------------------------------------------------------- */ @@ -122,8 +122,6 @@ do \ /* 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; \ @@ -144,11 +142,10 @@ do \ (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; \ diff --git a/src/include/access/xact.h b/src/include/access/xact.h index 67f5942536..80d220bc80 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -6,7 +6,7 @@ * * 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 $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,12 @@ typedef struct TransactionStateData 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 * ---------------- @@ -88,11 +94,6 @@ extern TransactionId DisabledTransactionId; 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); diff --git a/src/include/catalog/catname.h b/src/include/catalog/catname.h index 2130a472d0..d48dc07021 100644 --- a/src/include/catalog/catname.h +++ b/src/include/catalog/catname.h @@ -6,7 +6,7 @@ * * 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 $ * *------------------------------------------------------------------------- */ @@ -40,7 +40,6 @@ #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" diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 1729aeb2cd..2e3897c372 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -7,7 +7,7 @@ * * 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 @@ -208,14 +208,9 @@ DATA(insert OID = 0 ( 1247 typdefault 25 0 -1 16 0 -1 f f i f f)); 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 @@ -227,14 +222,9 @@ DATA(insert OID = 0 ( 1262 datpath 25 0 -1 3 0 -1 f f i f f)); 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 @@ -248,14 +238,9 @@ DATA(insert OID = 0 ( 1251 ctid 27 0 6 -1 0 -1 f f i f f)); 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 @@ -298,14 +283,9 @@ DATA(insert OID = 0 ( 1255 probin 17 0 -1 16 0 -1 f f i f f)); 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 @@ -317,14 +297,9 @@ DATA(insert OID = 0 ( 1257 serport 21 0 2 3 0 -1 t f s f f)); 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 @@ -339,14 +314,9 @@ DATA(insert OID = 0 ( 1260 usecatupd 16 0 1 6 0 -1 t f c f f)); 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 @@ -358,14 +328,9 @@ DATA(insert OID = 0 ( 1261 grolist 1007 0 -1 3 0 -1 f f i f f)); 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 @@ -402,14 +367,9 @@ DATA(insert OID = 0 ( 1249 atthasdef 16 0 1 13 0 -1 t f c f f)); 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 @@ -456,14 +416,9 @@ DATA(insert OID = 0 ( 1259 relacl 1034 0 -1 17 0 -1 f f i f f)); 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 @@ -474,14 +429,9 @@ DATA(insert OID = 0 ( 1253 magvalue 19 0 NAMEDATALEN 2 0 -1 f f i f f)); 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 @@ -492,14 +442,9 @@ DATA(insert OID = 0 ( 1263 defvalue 19 0 NAMEDATALEN 2 0 -1 f f i f f)); 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 @@ -512,14 +457,9 @@ DATA(insert OID = 0 ( 1215 adsrc 25 0 -1 4 0 -1 f f i f f)); 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 @@ -532,14 +472,9 @@ DATA(insert OID = 0 ( 1216 rcsrc 25 0 -1 4 0 -1 f f i f f)); 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 @@ -555,14 +490,9 @@ DATA(insert OID = 0 ( 1219 tgargs 17 0 -1 7 0 -1 f f i f f)); 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 @@ -596,15 +526,4 @@ DATA(insert OID = 0 ( 1264 varfoo 26 0 4 1 0 -1 t f i f f)); 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 */ diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index 8375115289..dad9f5c954 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -7,7 +7,7 @@ * * 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 @@ -141,7 +141,6 @@ DATA(insert OID = 1262 ( pg_database 88 PGUID 0 0 0 0 0 f t r n 3 0 0 0 f _nu 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_ )); @@ -160,7 +159,6 @@ DATA(insert OID = 1219 ( pg_trigger 111 PGUID 0 0 0 0 0 t t r n 7 0 0 0 f _nu #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 diff --git a/src/include/catalog/pg_time.h b/src/include/catalog/pg_time.h deleted file mode 100644 index 5767511037..0000000000 --- a/src/include/catalog/pg_time.h +++ /dev/null @@ -1,41 +0,0 @@ -/*------------------------------------------------------------------------- - * - * 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 */ diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index bbddb4da8a..0fde6eafe1 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -7,7 +7,7 @@ * * 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 @@ -186,7 +186,7 @@ DATA(insert OID = 26 ( oid PGUID 4 10 t b t \054 0 0 int4in int4out int4 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_ )); @@ -206,7 +206,6 @@ DATA(insert OID = 99 ( pg_log PGUID 1 1 t b t \054 1269 0 foo bar foo bar c _n /* 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_)); diff --git a/src/include/parser/parse_query.h b/src/include/parser/parse_query.h index 7775ec0260..fbc06f2d7b 100644 --- a/src/include/parser/parse_query.h +++ b/src/include/parser/parse_query.h @@ -6,7 +6,7 @@ * * 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 $ * *------------------------------------------------------------------------- */ @@ -34,9 +34,6 @@ addRangeTableEntry(ParseState *pstate, 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); diff --git a/src/include/postgres.h b/src/include/postgres.h index 37d966cf2f..504bb1aaad 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -6,7 +6,7 @@ * * 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 $ * *------------------------------------------------------------------------- */ @@ -163,7 +163,7 @@ typedef struct OidNameData *OidName; typedef uint32 TransactionId; #define InvalidTransactionId 0 -typedef uint16 CommandId; +typedef uint32 CommandId; #define FirstCommandId 0 diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h index 11253891a9..e07750bd3d 100644 --- a/src/include/utils/tqual.h +++ b/src/include/utils/tqual.h @@ -1,16 +1,12 @@ /*------------------------------------------------------------------------- * * 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 $ * *------------------------------------------------------------------------- */ @@ -19,11 +15,6 @@ #include -typedef struct TimeQualSpace -{ - char data[12]; -} TimeQualSpace; - typedef Pointer TimeQual; /* Tuples valid as of StartTransactionCommand */ @@ -35,10 +26,6 @@ extern TimeQual SelfTimeQual; 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); -- GitLab