econtext = NULL;
}
#endif /* OMIT_PARTIAL_INDEX */
- scan = heap_beginscan(heap, 0, NowTimeQual, 0, (ScanKey) NULL);
+ scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
htup = heap_getnext(scan, 0, &buffer);
/* int the tuples as we insert them */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.16 1997/09/08 21:40:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.17 1997/11/20 23:19:50 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
#endif /* OMIT_PARTIAL_INDEX */
/* start a heap scan */
- hscan = heap_beginscan(heap, 0, NowTimeQual, 0, (ScanKey) NULL);
+ hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
htup = heap_getnext(hscan, 0, &buffer);
/* build the index */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.21 1997/11/02 15:24:26 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.22 1997/11/20 23:19:57 momjian Exp $
*
*
* INTERFACE ROUTINES
ItemPointer tid,
int dir,
Buffer *b,
- TimeQual timeQual,
+ bool seeself,
int nkeys,
ScanKey key)
{
elog(DEBUG, "heapgettup(%.16s, tid=0x%x, dir=%d, ...)",
RelationGetRelationName(relation), tid, dir);
}
- elog(DEBUG, "heapgettup(..., b=0x%x, timeQ=0x%x, nkeys=%d, key=0x%x",
- b, timeQual, nkeys, key);
- if (timeQual == SelfTimeQual)
- {
- elog(DEBUG, "heapgettup: relation(%c)=`%.16s', SelfTimeQual",
- relation->rd_rel->relkind, &relation->rd_rel->relname);
- }
- else
- {
- elog(DEBUG, "heapgettup: relation(%c)=`%.16s', timeQual=%d",
- relation->rd_rel->relkind, &relation->rd_rel->relname,
- timeQual);
- }
+ elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", b, nkeys, key);
+
+ elog(DEBUG, "heapgettup: relation(%c)=`%.16s', %s",
+ relation->rd_rel->relkind, &relation->rd_rel->relname,
+ (seeself == true) ? "SeeSelf" : "NoSeeSelf");
#endif /* !defined(HEAPDEBUGALL) */
if (!ItemPointerIsValid(tid))
#ifndef NO_BUFFERISVALID
if (!BufferIsValid(*b))
- {
elog(WARN, "heapgettup: failed ReadBuffer");
- }
#endif
dp = (Page) BufferGetPage(*b);
* ----------------
*/
HeapTupleSatisfies(lpp, relation, *b, (PageHeader) dp,
- timeQual, nkeys, key, rtup);
+ seeself, nkeys, key, rtup);
if (rtup != NULL)
{
ItemPointer iptr = &(rtup->t_ctid);
HeapScanDesc
heap_beginscan(Relation relation,
int atend,
- TimeQual timeQual,
+ bool seeself,
unsigned nkeys,
ScanKey key)
{
/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
if (relation->rd_rel->relkind == RELKIND_UNCATALOGED)
- {
- timeQual = SelfTimeQual;
- }
+ seeself = true;
/* ----------------
* increment relation ref count while scanning relation
sdesc->rs_rd = relation;
if (nkeys)
- {
-
/*
* we do this here instead of in initsdesc() because heap_rescan
* also calls initsdesc() and we don't want to allocate memory
* again
*/
sdesc->rs_key = (ScanKey) palloc(sizeof(ScanKeyData) * nkeys);
- }
else
- {
sdesc->rs_key = NULL;
- }
initsdesc(sdesc, relation, atend, nkeys, key);
sdesc->rs_atend = atend;
- sdesc->rs_tr = timeQual;
+ sdesc->rs_seeself = seeself;
sdesc->rs_nkeys = (short) nkeys;
return (sdesc);
iptr,
-1,
&(sdesc->rs_cbuf),
- sdesc->rs_tr,
+ sdesc->rs_seeself,
sdesc->rs_nkeys,
sdesc->rs_key);
}
iptr,
1,
&sdesc->rs_cbuf,
- sdesc->rs_tr,
+ sdesc->rs_seeself,
sdesc->rs_nkeys,
sdesc->rs_key);
}
*/
HeapTuple
heap_fetch(Relation relation,
- TimeQual timeQual,
+ bool seeself,
ItemPointer tid,
Buffer *b)
{
*/
HeapTupleSatisfies(lp, relation, buffer, dp,
- timeQual, 0, (ScanKey) NULL, tuple);
+ seeself, 0, (ScanKey) NULL, tuple);
if (tuple == NULL)
{
* ----------------
*/
HeapTupleSatisfies(lp, relation, b, dp,
- NowTimeQual, 0, (ScanKey) NULL, tp);
+ false, 0, (ScanKey) NULL, tp);
if (!tp)
{
relation,
buffer,
(PageHeader) dp,
- NowTimeQual,
+ false,
0,
(ScanKey) NULL,
tuple);
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
-1,
&sdesc->rs_pbuf,
- sdesc->rs_tr,
+ sdesc->rs_seeself,
sdesc->rs_nkeys,
sdesc->rs_key);
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
1,
&sdesc->rs_nbuf,
- sdesc->rs_tr,
+ sdesc->rs_seeself,
sdesc->rs_nkeys,
sdesc->rs_key);
}
&sdesc->rs_mptid,
0,
&sdesc->rs_pbuf,
- NowTimeQual,
+ false,
0,
(ScanKey) NULL);
}
&sdesc->rs_mctid,
0,
&sdesc->rs_cbuf,
- NowTimeQual,
+ false,
0,
(ScanKey) NULL);
}
&sdesc->rs_mntid,
0,
&sdesc->rs_nbuf,
- NowTimeQual,
+ false,
0,
(ScanKey) NULL);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.12 1997/09/08 21:41:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.13 1997/11/20 23:20:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ObjectIdEqualRegProcedure,
ObjectIdGetDatum(operatorObjectId));
- scan = heap_beginscan(operatorRelation, false, NowTimeQual,
+ scan = heap_beginscan(operatorRelation, false, false,
1, &scanKeyData);
tuple = heap_getnext(scan, false, (Buffer *) NULL);
ObjectIdGetDatum(indexObjectId));
relation = heap_openr(IndexRelationName);
- scan = heap_beginscan(relation, false, NowTimeQual, 1, entry);
+ scan = heap_beginscan(relation, false, false, 1, entry);
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
elog(WARN, "IndexSupportInitialize: corrupted catalogs");
entry[1].sk_argument =
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
- scan = heap_beginscan(relation, false, NowTimeQual, 2, entry);
+ scan = heap_beginscan(relation, false, false, 2, entry);
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
for (strategy = 1; strategy <= maxStrategyNumber; strategy++)
ScanKeyEntrySetIllegal(StrategyMapGetScanKeyEntry(map, strategy));
- scan = heap_beginscan(relation, false, NowTimeQual, 2, entry);
+ scan = heap_beginscan(relation, false, false, 2, entry);
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.20 1997/09/08 21:41:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.21 1997/11/20 23:20:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{ /* they're equal */
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
itup = &(btitem->bti_itup);
- htup = heap_fetch(heapRel, SelfTimeQual, &(itup->t_tid), NULL);
+ htup = heap_fetch(heapRel, true, &(itup->t_tid), NULL);
if (htup != (HeapTuple) NULL)
{ /* it is a duplicate */
elog(WARN, "Cannot insert a duplicate key into a unique index.");
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.23 1997/09/08 21:41:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.24 1997/11/20 23:20:21 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
#endif /* OMIT_PARTIAL_INDEX */
/* start a heap scan */
- hscan = heap_beginscan(heap, 0, NowTimeQual, 0, (ScanKey) NULL);
+ hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
htup = heap_getnext(hscan, 0, &buffer);
/* build the index */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.18 1997/09/18 20:19:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.19 1997/11/20 23:20:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
slot = NULL;
}
#endif /* OMIT_PARTIAL_INDEX */
- scan = heap_beginscan(heap, 0, NowTimeQual, 0, (ScanKey) NULL);
+ scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
htup = heap_getnext(scan, 0, &buffer);
/* count the tuples as we insert them */
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.27 1997/11/17 16:58:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.28 1997/11/20 23:20:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
StartPortalAllocMode(DefaultAllocMode, 0);
rdesc = heap_openr(TypeRelationName);
- sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+ sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
for (i = 0; PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)); ++i);
heap_endscan(sdesc);
app = Typ = ALLOC(struct typmap *, i + 1);
while (i-- > 0)
*app++ = ALLOC(struct typmap, 1);
*app = (struct typmap *) NULL;
- sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+ sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
app = Typ;
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
{
if (DebugMode)
printf("bootstrap.c: External Type: %s\n", type);
rdesc = heap_openr(TypeRelationName);
- sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+ sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
i = 0;
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
++i;
while (i-- > 0)
*app++ = ALLOC(struct typmap, 1);
*app = (struct typmap *) NULL;
- sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+ sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
app = Typ;
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.30 1997/11/02 15:24:55 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.31 1997/11/20 23:20:38 momjian Exp $
*
* INTERFACE ROUTINES
* heap_creatr() - Create an uncataloged heap relation
*/
pg_class_scan = heap_beginscan(pg_class_desc,
0,
- NowTimeQual,
+ false,
1,
&key);
scan = heap_beginscan(catalogRelation,
false,
- NowTimeQual,
+ false,
1,
&entry);
scan = heap_beginscan(catalogRelation,
false,
- NowTimeQual,
+ false,
1,
&entry);
scan = heap_beginscan(catalogRelation,
false,
- NowTimeQual,
+ false,
1,
&entry);
scan = heap_beginscan(indexRelation,
false,
- NowTimeQual,
+ false,
1,
&entry);
pg_class_scan = heap_beginscan(pg_class_desc,
0,
- NowTimeQual,
+ false,
1,
&key);
pg_attribute_scan = heap_beginscan(pg_attribute_desc,
0,
- NowTimeQual,
+ false,
1,
&key);
pg_type_scan = heap_beginscan(pg_type_desc,
0,
- NowTimeQual,
+ false,
1,
&key);
pg_attribute_scan = heap_beginscan(pg_attribute_desc,
0,
- NowTimeQual,
+ false,
1,
&attkey);
RelationSetLockForWrite(adrel);
- adscan = heap_beginscan(adrel, 0, NowTimeQual, 1, &key);
+ adscan = heap_beginscan(adrel, 0, false, 1, &key);
while (tup = heap_getnext(adscan, 0, (Buffer *) NULL), PointerIsValid(tup))
heap_delete(adrel, &tup->t_ctid);
RelationSetLockForWrite(rcrel);
- rcscan = heap_beginscan(rcrel, 0, NowTimeQual, 1, &key);
+ rcscan = heap_beginscan(rcrel, 0, false, 1, &key);
while (tup = heap_getnext(rcscan, 0, (Buffer *) NULL), PointerIsValid(tup))
heap_delete(rcrel, &tup->t_ctid);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.25 1997/11/02 15:25:01 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.26 1997/11/20 23:20:44 momjian Exp $
*
*
* INTERFACE ROUTINES
NameEqualRegProcedure,
PointerGetDatum(relationName));
- pg_class_scan = heap_beginscan(pg_class, 0, NowTimeQual, 1, &key);
+ pg_class_scan = heap_beginscan(pg_class, 0, false, 1, &key);
/* ----------------
* if we find the named relation, fetch its relation id
* ----------------
*/
pg_am_desc = heap_openr(AccessMethodRelationName);
- pg_am_scan = heap_beginscan(pg_am_desc, 0, NowTimeQual, 1, &key);
+ pg_am_scan = heap_beginscan(pg_am_desc, 0, false, 1, &key);
pg_am_tuple = heap_getnext(pg_am_scan, 0, (Buffer *) NULL);
ObjectIdEqualRegProcedure,
ObjectIdGetDatum(indexoid));
- scan = heap_beginscan(pg_index, 0, NowTimeQual, 1, &entry);
+ scan = heap_beginscan(pg_index, 0, false, 1, &entry);
tuple = heap_getnext(scan, 0, &buffer);
heap_endscan(scan);
ObjectIdEqualRegProcedure,
ObjectIdGetDatum(indexId));;
- scan = heap_beginscan(catalogRelation, 0, NowTimeQual, 1, &entry);
+ scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
AssertState(HeapTupleIsValid(tuple));
entry.sk_attno = Anum_pg_attribute_attrelid;
- scan = heap_beginscan(catalogRelation, 0, NowTimeQual, 1, &entry);
+ scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
entry.sk_attno = Anum_pg_index_indexrelid;
- scan = heap_beginscan(catalogRelation, 0, NowTimeQual, 1, &entry);
+ scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
key[0].sk_argument = ObjectIdGetDatum(relid);
pg_class_scan =
- heap_beginscan(pg_class, 0, NowTimeQual, 1, key);
+ heap_beginscan(pg_class, 0, false, 1, key);
if (!HeapScanIsValid(pg_class_scan))
{
*/
scan = heap_beginscan(heapRelation, /* relation */
0, /* start at end */
- NowTimeQual, /* time range */
+ false, /* seeself */
0, /* number of keys */
(ScanKey) NULL); /* scan key */
(RegProcedure) ObjectIdEqualRegProcedure,
ObjectIdGetDatum(indexId));
- scandesc = heap_beginscan(pg_index, 0, SelfTimeQual, 1, skey);
+ scandesc = heap_beginscan(pg_index, 0, true, 1, skey);
tuple = heap_getnext(scandesc, 0, NULL);
if (!HeapTupleIsValid(tuple))
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.15 1997/09/08 21:42:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.16 1997/11/20 23:20:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ItemPointer iptr;
iptr = &indexRes->heap_iptr;
- tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
+ tuple = heap_fetch(heapRelation, false, iptr, &buffer);
pfree(indexRes);
}
else
ItemPointer iptr;
iptr = &indexRes->heap_iptr;
- tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
+ tuple = heap_fetch(heapRelation, false, iptr, &buffer);
pfree(indexRes);
if (HeapTupleIsValid(tuple))
{
ItemPointer iptr;
iptr = &indexRes->heap_iptr;
- tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
+ tuple = heap_fetch(heapRelation, false, iptr, &buffer);
pfree(indexRes);
}
else
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.14 1997/09/18 20:20:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.15 1997/11/20 23:20:49 momjian Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
*/
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
- SelfTimeQual,
+ true,
3,
opKey);
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
- SelfTimeQual,
+ true,
3,
opKey);
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
- SelfTimeQual,
+ true,
1,
opKey);
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
- SelfTimeQual,
+ true,
1,
opKey);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.11 1997/09/18 20:20:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.12 1997/11/20 23:20:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
scan = heap_beginscan(pg_type_desc,
0,
- SelfTimeQual,
+ true,
1,
typeKey);
typeKey[0].sk_argument = PointerGetDatum(typeName);
pg_type_scan = heap_beginscan(pg_type_desc,
0,
- SelfTimeQual,
+ true,
1,
typeKey);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.23 1997/11/05 21:18:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.24 1997/11/20 23:20:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
lRel = heap_openr(ListenerRelationName);
tdesc = RelationGetTupleDescriptor(lRel);
RelationSetLockForWrite(lRel);
- sRel = heap_beginscan(lRel, 0, NowTimeQual, 1, &key);
+ sRel = heap_beginscan(lRel, 0, false, 1, &key);
nulls[0] = nulls[1] = nulls[2] = ' ';
repl[0] = repl[1] = repl[2] = ' ';
Int32GetDatum(1));
lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel);
- sRel = heap_beginscan(lRel, 0, NowTimeQual, 1, &key);
+ sRel = heap_beginscan(lRel, 0, false, 1, &key);
tdesc = RelationGetTupleDescriptor(lRel);
ourpid = getpid();
/* is someone already listening. One listener per relation */
tdesc = RelationGetTupleDescriptor(lDesc);
- s = heap_beginscan(lDesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+ s = heap_beginscan(lDesc, 0, false, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(s, 0, &b)))
{
d = heap_getattr(htup, b, Anum_pg_listener_relname, tdesc,
lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel);
tdesc = RelationGetTupleDescriptor(lRel);
- sRel = heap_beginscan(lRel, 0, NowTimeQual, 2, key);
+ sRel = heap_beginscan(lRel, 0, false, 2, key);
nulls[0] = nulls[1] = nulls[2] = ' ';
repl[0] = repl[1] = repl[2] = ' ';
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.15 1997/09/08 02:21:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.16 1997/11/20 23:20:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
HeapTid = &ScanResult->heap_iptr;
- LocalHeapTuple = heap_fetch(LocalOldHeap, 0, HeapTid, &LocalBuffer);
+ LocalHeapTuple = heap_fetch(LocalOldHeap, false, HeapTid, &LocalBuffer);
OIDNewHeapInsert =
heap_insert(LocalNewHeap, LocalHeapTuple);
pfree(ScanResult);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.20 1997/10/27 08:55:16 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.21 1997/11/20 23:21:00 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
* XXX use syscache here as an optimization
*/
key[1].sk_argument = (Datum) colDef->colname;
- attsdesc = heap_beginscan(attrdesc, 0, NowTimeQual, 2, key);
+ attsdesc = heap_beginscan(attrdesc, 0, false, 2, key);
tup = heap_getnext(attsdesc, 0, (Buffer *) NULL);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.34 1997/09/12 04:07:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.35 1997/11/20 23:21:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
int32 ntuples;
TupleDesc tupDesc;
- scandesc = heap_beginscan(rel, 0, NULL, 0, NULL);
+ scandesc = heap_beginscan(rel, 0, false, 0, NULL);
attr_count = rel->rd_att->natts;
attr = rel->rd_att->attrs;
bool isnull;
pg_index_rel = heap_openr(IndexRelationName);
- scandesc = heap_beginscan(pg_index_rel, 0, NULL, 0, NULL);
+ scandesc = heap_beginscan(pg_index_rel, 0, false, 0, NULL);
tupDesc = RelationGetTupleDescriptor(pg_index_rel);
*n_indices = 0;
int i;
- scandesc = heap_beginscan(relation, 0, NULL, 0, NULL);
+ scandesc = heap_beginscan(relation, 0, false, 0, NULL);
for (tuple = heap_getnext(scandesc, 0, NULL), i = 0;
tuple != NULL;
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_language_lanname,
F_NAMEEQ, PointerGetDatum(languageName));
- scanDesc = heap_beginscan(rdesc, 0, NowTimeQual, 1, &scanKeyData);
+ scanDesc = heap_beginscan(rdesc, 0, false, 1, &scanKeyData);
tup = heap_getnext(scanDesc, 0, (Buffer *) NULL);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/purge.c,v 1.8 1997/09/08 02:22:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/purge.c,v 1.9 1997/11/20 23:21:08 momjian Exp $
*
* Note:
* XXX There are many instances of int32 instead of ...Time. These
key[0].sk_argument = PointerGetDatum(relationName);
fmgr_info(key[0].sk_procedure, &key[0].sk_func, &key[0].sk_nargs);
- scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
+ scan = heap_beginscan(relation, 0, false, 1, key);
oldTuple = heap_getnext(scan, 0, &buffer);
if (!HeapTupleIsValid(oldTuple))
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.10 1997/10/25 01:08:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.11 1997/11/20 23:21:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
tt,
tt,
FALSE,
- FALSE,
- NULL));
+ FALSE));
rt_ind = length(orig->rtable);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.15 1997/09/18 20:20:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.16 1997/11/20 23:21:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ObjectIdGetDatum(typeId2));
relation = heap_openr(OperatorRelationName);
- scan = heap_beginscan(relation, 0, NowTimeQual, 3, operatorKey);
+ scan = heap_beginscan(relation, 0, false, 3, operatorKey);
tup = heap_getnext(scan, 0, &buffer);
if (HeapTupleIsValid(tup))
{
for (i = 0; i < 3; ++i)
{
key[0].sk_attno = attnums[i];
- sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 1, key);
+ sdesc = heap_beginscan(rdesc, 0, false, 1, key);
while (PointerIsValid(tup = heap_getnext(sdesc, 0, &buffer)))
{
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
oidptr->next = NULL;
optr = oidptr;
rdesc = heap_openr(AttributeRelationName);
- sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 1, key);
+ sdesc = heap_beginscan(rdesc, 0, false, 1, key);
while (PointerIsValid(tup = heap_getnext(sdesc, 0, &buffer)))
{
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
while (PointerIsValid((char *) optr->next))
{
key[0].sk_argument = (Datum) (optr++)->reloid;
- sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 1, key);
+ sdesc = heap_beginscan(rdesc, 0, false, 1, key);
tup = heap_getnext(sdesc, 0, &buffer);
if (PointerIsValid(tup))
{
typeKey[0].sk_argument = PointerGetDatum(typeName);
- scan = heap_beginscan(relation, 0, NowTimeQual, 1, typeKey);
+ scan = heap_beginscan(relation, 0, false, 1, typeKey);
tup = heap_getnext(scan, 0, (Buffer *) 0);
if (!HeapTupleIsValid(tup))
{
shadow_type = makeArrayTypeName(typeName);
typeKey[0].sk_argument = NameGetDatum(shadow_type);
- scan = heap_beginscan(relation, 0, NowTimeQual,
+ scan = heap_beginscan(relation, 0, false,
1, (ScanKey) typeKey);
tup = heap_getnext(scan, 0, (Buffer *) 0);
fmgr_info(key[0].sk_procedure, &key[0].sk_func, &key[0].sk_nargs);
relation = heap_openr(ProcedureRelationName);
- scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
+ scan = heap_beginscan(relation, 0, false, 1, key);
do
{ /* hope this is ok because it's indexed */
ObjectIdGetDatum(basetypeID));
relation = heap_openr(AggregateRelationName);
- scan = heap_beginscan(relation, 0, NowTimeQual, 2, aggregateKey);
+ scan = heap_beginscan(relation, 0, false, 2, aggregateKey);
tup = heap_getnext(scan, 0, (Buffer *) 0);
if (!HeapTupleIsValid(tup))
{
RelationSetLockForWrite(tgrel);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
ObjectIdEqualRegProcedure, rel->rd_id);
- tgscan = heap_beginscan(tgrel, 0, NowTimeQual, 1, &key);
+ tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
{
Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
RelationSetLockForWrite(tgrel);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
ObjectIdEqualRegProcedure, rel->rd_id);
- tgscan = heap_beginscan(tgrel, 0, NowTimeQual, 1, &key);
+ tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
{
Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
ObjectIdEqualRegProcedure, rel->rd_id);
- tgscan = heap_beginscan(tgrel, 0, NowTimeQual, 1, &key);
+ tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
while (tup = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tup))
heap_delete(tgrel, &tup->t_ctid);
break;
iptr = &indexRes->heap_iptr;
- tuple = heap_fetch(tgrel, NowTimeQual, iptr, &buffer);
+ tuple = heap_fetch(tgrel, false, iptr, &buffer);
pfree(indexRes);
if (!HeapTupleIsValid(tuple))
continue;
}
HeapTupleSatisfies(lp, relation, b, dp,
- NowTimeQual, 0, (ScanKey) NULL, tuple);
+ false, 0, (ScanKey) NULL, tuple);
if (!tuple)
{
ReleaseBuffer(b);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.49 1997/11/02 15:25:07 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.50 1997/11/20 23:21:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
pgclass = heap_openr(RelationRelationName);
pgcdesc = RelationGetTupleDescriptor(pgclass);
- pgcscan = heap_beginscan(pgclass, false, NowTimeQual, 1, &pgckey);
+ pgcscan = heap_beginscan(pgclass, false, false, 1, &pgckey);
while (HeapTupleIsValid(pgctup = heap_getnext(pgcscan, 0, &buf)))
{
pgclass = heap_openr(RelationRelationName);
pgcdesc = RelationGetTupleDescriptor(pgclass);
- pgcscan = heap_beginscan(pgclass, false, NowTimeQual, 1, &pgckey);
+ pgcscan = heap_beginscan(pgclass, false, false, 1, &pgckey);
/*
* Race condition -- if the pg_class tuple has gone away since the
ObjectIdGetDatum(relid));
rd = heap_openr(RelationRelationName);
- rsdesc = heap_beginscan(rd, false, NowTimeQual, 1, &rskey);
+ rsdesc = heap_beginscan(rd, false, false, 1, &rskey);
if (!HeapTupleIsValid(rtup = heap_getnext(rsdesc, 0, &rbuf)))
elog(WARN, "pg_class entry for relid %d vanished during vacuuming",
ScanKeyEntryInitialize(&askey, 0, Anum_pg_attribute_attrelid,
F_INT4EQ, relid);
- asdesc = heap_beginscan(ad, false, NowTimeQual, 1, &askey);
+ asdesc = heap_beginscan(ad, false, false, 1, &askey);
while (HeapTupleIsValid(atup = heap_getnext(asdesc, 0, &abuf)))
{
ScanKeyEntryInitialize(&pgskey, 0x0, Anum_pg_statistic_starelid,
ObjectIdEqualRegProcedure,
ObjectIdGetDatum(relid));
- pgsscan = heap_beginscan(pgstatistic, false, NowTimeQual, 1, &pgskey);
+ pgsscan = heap_beginscan(pgstatistic, false, false, 1, &pgskey);
}
else
- pgsscan = heap_beginscan(pgstatistic, false, NowTimeQual, 0, NULL);
+ pgsscan = heap_beginscan(pgstatistic, false, false, 0, NULL);
while (HeapTupleIsValid(pgstup = heap_getnext(pgsscan, 0, NULL)))
{
ObjectIdEqualRegProcedure,
ObjectIdGetDatum(relid));
- pgiscan = heap_beginscan(pgindex, false, NowTimeQual, 1, &pgikey);
+ pgiscan = heap_beginscan(pgindex, false, false, 1, &pgikey);
while (HeapTupleIsValid(pgitup = heap_getnext(pgiscan, 0, NULL)))
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.13 1997/11/17 16:58:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.14 1997/11/20 23:21:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
rt_entry1 =
addRangeTableEntry(NULL, (char *) viewName, "*CURRENT*",
- FALSE, FALSE, NULL);
+ FALSE, FALSE);
rt_entry2 =
addRangeTableEntry(NULL, (char *) viewName, "*NEW*",
- FALSE, FALSE, NULL);
+ FALSE, FALSE);
new_rt = lcons(rt_entry2, old_rt);
new_rt = lcons(rt_entry1, new_rt);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.8 1997/09/08 21:42:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.9 1997/11/20 23:21:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static Pointer
ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
- bool isindex, ScanDirection dir, TimeQual time_range);
+ bool isindex, ScanDirection dir);
static Relation ExecOpenR(Oid relationOid, bool isindex);
/* ----------------------------------------------------------------
ScanKey skeys,
bool isindex,
ScanDirection dir,
- TimeQual timeRange,
Relation *returnRelation, /* return */
Pointer *returnScanDesc) /* return */
{
nkeys,
skeys,
isindex,
- dir,
- timeRange);
+ dir);
if (returnRelation != NULL)
*returnRelation = relation;
int nkeys,
ScanKey skeys,
bool isindex,
- ScanDirection dir,
- TimeQual time_range)
+ ScanDirection dir)
{
Pointer scanDesc;
{
scanDesc = (Pointer) heap_beginscan(relation,
ScanDirectionIsBackward(dir),
- time_range,
+ false,
nkeys,
skeys);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.30 1997/11/17 16:41:04 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.31 1997/11/20 23:21:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
slot->ttc_buffer = InvalidBuffer;
slot->ttc_whichplan = -1;
rte->relname = nameout(&(rel->rd_rel->relname));
- rte->timeRange = NULL;
rte->refname = rte->relname;
rte->relid = rel->rd_id;
rte->inh = false;
rte->archive = false;
rte->inFromCl = true;
- rte->timeQual = NULL;
rtlist = lcons(rte, NIL);
econtext->ecxt_scantuple = slot; /* scan tuple slot */
econtext->ecxt_innertuple = NULL; /* inner tuple slot */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.20 1997/10/25 01:09:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.21 1997/11/20 23:21:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
indexSd = heap_beginscan(indexRd, /* scan desc */
false, /* scan backward flag */
- NowTimeQual, /* time qual */
+ false, /* see self */
1, /* number scan keys */
&key); /* scan keys */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.10 1997/09/08 21:43:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.11 1997/11/20 23:21:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
iptr = &result->heap_iptr;
tuple = heap_fetch(heapRelation,
- NowTimeQual,
+ false,
iptr,
&buffer);
/* be tidy */
RangeTblEntry *rtentry;
Index relid;
Oid reloid;
- TimeQual timeQual;
Relation currentRelation;
HeapScanDesc currentScanDesc;
relid = node->scan.scanrelid;
rtentry = rt_fetch(relid, rangeTable);
reloid = rtentry->relid;
- timeQual = rtentry->timeQual;
ExecOpenScanR(reloid, /* relation */
0, /* nkeys */
(ScanKey) NULL, /* scan key */
0, /* is index */
direction, /* scan direction */
- timeQual, /* time qual */
¤tRelation, /* return: rel desc */
(Pointer *) ¤tScanDesc); /* return: scan desc */
scanKeys[i], /* scan key */
true, /* is index */
direction, /* scan direction */
- timeQual, /* time qual */
&(relationDescs[i]), /* return: rel desc */
(Pointer *) &(scanDescs[i]));
/* return: scan desc */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.9 1997/09/08 21:43:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.10 1997/11/20 23:21:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
currentScanDesc = heap_beginscan(currentRelation, /* relation */
ScanDirectionIsBackward(dir),
/* bkwd flag */
- NowTimeQual, /* time qual */
+ false, /* seeself */
0, /* num scan keys */
NULL); /* scan keys */
matstate->csstate.css_currentRelation = currentRelation;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.7 1997/09/08 21:43:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.8 1997/11/20 23:21:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List *rangeTable;
RangeTblEntry *rtentry;
Oid reloid;
- TimeQual timeQual;
ScanDirection direction;
Relation currentRelation;
HeapScanDesc currentScanDesc;
rangeTable = estate->es_range_table;
rtentry = rt_fetch(relid, rangeTable);
reloid = rtentry->relid;
- timeQual = rtentry->timeQual;
direction = estate->es_direction;
resultRelationInfo = estate->es_result_relation_info;
NULL, /* scan key */
0, /* is index */
direction,/* scan direction */
- timeQual, /* time qual */
¤tRelation, /* return: rel desc */
(Pointer *) ¤tScanDesc); /* return: scan desc */
* ExecEndTee
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.9 1997/09/08 21:43:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.10 1997/11/20 23:21:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
ScanDirectionIsBackward(dir),
- NowTimeQual, /* time qual */
+ false, /* seeself */
0, /* num scan keys */
NULL /* scan keys */
);
{
teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
ScanDirectionIsBackward(dir),
- NowTimeQual, /* time qual */
+ false, /* seeself */
0, /* num scan keys */
NULL /* scan keys */
);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.14 1997/11/02 15:25:11 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.15 1997/11/20 23:21:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
newnode->relname = pstrdup(from->relname);
if (from->refname)
newnode->refname = pstrdup(from->refname);
- newnode->timeRange = NULL;
- newnode->timeQual = NULL;
return newnode;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.11 1997/09/08 21:44:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.12 1997/11/20 23:21:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* will be used to find the associated strategy numbers for the test.
* --Nels, Jan '93
*/
- scan = heap_beginscan(relation, false, NowTimeQual, 2, entry);
+ scan = heap_beginscan(relation, false, false, 2, entry);
tuple = heap_getnext(scan, false, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
ObjectIdEqualRegProcedure,
ObjectIdGetDatum(clause_op));
- scan = heap_beginscan(relation, false, NowTimeQual, 3, entry);
+ scan = heap_beginscan(relation, false, false, 3, entry);
tuple = heap_getnext(scan, false, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
Integer16EqualRegProcedure,
Int16GetDatum(test_strategy));
- scan = heap_beginscan(relation, false, NowTimeQual, 3, entry);
+ scan = heap_beginscan(relation, false, false, 3, entry);
tuple = heap_getnext(scan, false, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
+++ /dev/null
-/*-------------------------------------------------------------------------
- *
- * archive.c--
- * Support for planning scans on archived relations
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Attic/archive.c,v 1.4 1997/09/08 21:45:29 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-#include <stdio.h> /* for sprintf() */
-#include <sys/types.h> /* for u_int in relcache.h */
-#include "postgres.h"
-
-#include "utils/rel.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-#include "utils/relcache.h"
-#include "catalog/pg_class.h"
-#include "nodes/pg_list.h"
-#include "nodes/parsenodes.h"
-#include "optimizer/prep.h"
-#include "commands/creatinh.h"
-
-void
-plan_archive(List *rt)
-{
- List *rtitem;
- RangeTblEntry *rte;
- TimeRange *trange;
- Relation r;
- Oid reloid;
-
- foreach(rtitem, rt)
- {
- rte = lfirst(rtitem);
- trange = rte->timeRange;
- if (trange)
- {
- reloid = rte->relid;
- r = RelationIdGetRelation(reloid);
- if (r->rd_rel->relarch != 'n')
- {
- rte->archive = true;
- }
- }
- }
-}
-
-
-/*
- * find_archive_rels -- Given a particular relid, find the archive
- * relation's relid.
- */
-List *
-find_archive_rels(Oid relid)
-{
- Relation arel;
- char *arelName;
-
- arelName = MakeArchiveName(relid);
- arel = RelationNameGetRelation(arelName);
- pfree(arelName);
-
- return lconsi(arel->rd_id, lconsi(relid, NIL));
-}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.6 1997/09/08 21:45:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.7 1997/11/20 23:21:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
union_relids = VersionGetParents(rt_entry->relid);
break;
- case ARCHIVE_FLAG:
- union_relids = find_archive_rels(rt_entry->relid);
- break;
-
default:
/* do nothing */
break;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.10 1997/09/18 20:20:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.11 1997/11/20 23:22:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ObjectIdGetDatum(indrelid));
relation = heap_openr(IndexRelationName);
- scan = heap_beginscan(relation, 0, NowTimeQual,
+ scan = heap_beginscan(relation, 0, false,
1, &indexKey);
}
if (!HeapScanIsValid(scan))
key[0].sk_argument = ObjectIdGetDatum((Oid) inhparent);
relation = heap_openr(InheritsRelationName);
- scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
+ scan = heap_beginscan(relation, 0, false, 1, key);
while (HeapTupleIsValid(inheritsTuple =
heap_getnext(scan, 0,
(Buffer *) NULL)))
fmgr_info(F_OIDEQ, &key[0].sk_func, &key[0].sk_nargs);
relation = heap_openr(VersionRelationName);
key[0].sk_argument = ObjectIdGetDatum(verrelid);
- scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
+ scan = heap_beginscan(relation, 0, false, 1, key);
for (;;)
{
versionTuple = heap_getnext(scan, 0,
# Makefile for parser
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.9 1997/11/14 15:48:19 thomas Exp $
+# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.10 1997/11/20 23:22:05 momjian Exp $
#
#-------------------------------------------------------------------------
OBJS= analyze.o catalog_utils.o dbcommands.o gram.o \
- keywords.o parser.o parse_query.o scan.o scansup.o sysfunc.o
+ keywords.o parser.o parse_query.o scan.o scansup.o
all: SUBSYS.o
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.48 1997/10/30 16:34:22 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.49 1997/11/20 23:22:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "nodes/parsenodes.h"
#include "nodes/relation.h"
#include "parse.h" /* for AND, OR, etc. */
+#include "catalog/pg_aggregate.h"
#include "catalog/pg_type.h" /* for INT4OID, etc. */
#include "catalog/pg_proc.h"
#include "utils/elog.h"
static char *figureColname(Node *expr, Node *resval);
static List *makeTargetNames(ParseState *pstate, List *cols);
static List *transformTargetList(ParseState *pstate, List *targetlist);
-static TargetEntry *
-make_targetlist_expr(ParseState *pstate,
+static TargetEntry *make_targetlist_expr(ParseState *pstate,
char *colname, Node *expr,
List *arrayRef);
static bool inWhereClause = false;
static Node *transformWhereClause(ParseState *pstate, Node *a_expr);
-static List *
-transformGroupClause(ParseState *pstate, List *grouplist,
+static List *transformGroupClause(ParseState *pstate, List *grouplist,
List *targetlist);
-static List *
-transformSortClause(ParseState *pstate,
+static List *transformSortClause(ParseState *pstate,
List *orderlist, List *targetlist,
char *uniqueFlag);
static void parseFromClause(ParseState *pstate, List *frmList);
-static Node *
-ParseFunc(ParseState *pstate, char *funcname,
+static Node *ParseFunc(ParseState *pstate, char *funcname,
List *fargs, int *curr_resno);
static List *setup_tlist(char *attname, Oid relid);
static List *setup_base_tlist(Oid typeid);
-static void
-make_arguments(int nargs, List *fargs, Oid *input_typeids,
+static void make_arguments(int nargs, List *fargs, Oid *input_typeids,
Oid *function_typeids);
static void AddAggToParseState(ParseState *pstate, Aggreg *aggreg);
static void finalizeAggregates(ParseState *pstate, Query *qry);
static void parseCheckAggregates(ParseState *pstate, Query *qry);
static ParseState *makeParseState(void);
+static Node *parser_typecast(Value *expr, TypeName *typename, int typlen);
+static Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen);
+static Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target);
/*****************************************************************************
*
* equal to 2.
*/
addRangeTableEntry(pstate, stmt->object->relname, "*CURRENT*",
- FALSE, FALSE, NULL);
+ FALSE, FALSE);
addRangeTableEntry(pstate, stmt->object->relname, "*NEW*",
- FALSE, FALSE, NULL);
+ FALSE, FALSE);
pstate->p_last_resno = 1;
pstate->p_is_rule = true; /* for expand all */
* eg. select * from foo f where f.x = 1; will generate wrong answer
* if we expand * to foo.x.
*/
- rte = addRangeTableEntry(pstate, relname, refname, baserel->inh, TRUE,
- baserel->timeRange);
+ rte = addRangeTableEntry(pstate, relname, refname, baserel->inh, TRUE);
}
}
return;
if (refnameRangeTablePosn(pstate->p_rtable, relname) < 1)
- rte = addRangeTableEntry(pstate, relname, relname, FALSE, FALSE, NULL);
+ rte = addRangeTableEntry(pstate, relname, relname, FALSE, FALSE);
else
rte = refnameRangeTableEntry(pstate->p_rtable, relname);
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
if (rte == NULL)
- rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE, NULL);
+ rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE);
relname = rte->relname;
relid = rte->relid;
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
if (rte == NULL)
rte = addRangeTableEntry(pstate, refname, refname,
- FALSE, FALSE, NULL);
+ FALSE, FALSE);
relname = rte->relname;
vnum = refnameRangeTablePosn(pstate->p_rtable, rte->refname);
*/
return;
}
+
+/* not used
+#define PSIZE(PTR) (*((int32 *)(PTR) - 1))
+*/
+
+static Node *
+parser_typecast(Value *expr, TypeName *typename, int typlen)
+{
+ /* check for passing non-ints */
+ Const *adt;
+ Datum lcp;
+ Type tp;
+ char type_string[NAMEDATALEN];
+ int32 len;
+ char *cp = NULL;
+ char *const_string = NULL;
+ bool string_palloced = false;
+
+ switch (nodeTag(expr))
+ {
+ case T_String:
+ const_string = DatumGetPointer(expr->val.str);
+ break;
+ case T_Integer:
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%ld", expr->val.ival);
+ break;
+ default:
+ elog(WARN,
+ "parser_typecast: cannot cast this expression to type \"%s\"",
+ typename->name);
+ }
+
+ if (typename->arrayBounds != NIL)
+ {
+ sprintf(type_string, "_%s", typename->name);
+ tp = (Type) type(type_string);
+ }
+ else
+ {
+ tp = (Type) type(typename->name);
+ }
+
+ len = tlen(tp);
+
+#if 0 /* fix me */
+ switch (CInteger(lfirst(expr)))
+ {
+ case INT4OID: /* int4 */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%d", ((Const *) lnext(expr))->constvalue);
+ break;
+
+ case NAMEOID: /* char16 */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%s", ((Const *) lnext(expr))->constvalue);
+ break;
+
+ case CHAROID: /* char */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%c", ((Const) lnext(expr))->constvalue);
+ break;
+
+ case FLOAT8OID: /* float8 */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%f", ((Const) lnext(expr))->constvalue);
+ break;
+
+ case CASHOID: /* money */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%d",
+ (int) ((Const *) expr)->constvalue);
+ break;
+
+ case TEXTOID: /* text */
+ const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
+ const_string = (char *) textout((struct varlena *) const_string);
+ break;
+
+ case UNKNOWNOID: /* unknown */
+ const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
+ const_string = (char *) textout((struct varlena *) const_string);
+ break;
+
+ default:
+ elog(WARN, "unknown type %d", CInteger(lfirst(expr)));
+ }
+#endif
+
+ cp = instr2(tp, const_string, typlen);
+
+ if (!tbyvalue(tp))
+ {
+/*
+ if (len >= 0 && len != PSIZE(cp)) {
+ char *pp;
+ pp = (char *) palloc(len);
+ memmove(pp, cp, len);
+ cp = pp;
+ }
+*/
+ lcp = PointerGetDatum(cp);
+ }
+ else
+ {
+ switch (len)
+ {
+ case 1:
+ lcp = Int8GetDatum(cp);
+ break;
+ case 2:
+ lcp = Int16GetDatum(cp);
+ break;
+ case 4:
+ lcp = Int32GetDatum(cp);
+ break;
+ default:
+ lcp = PointerGetDatum(cp);
+ break;
+ }
+ }
+
+ adt = makeConst(typeid(tp),
+ len,
+ (Datum) lcp,
+ false,
+ tbyvalue(tp),
+ false, /* not a set */
+ true /* is cast */ );
+
+ if (string_palloced)
+ pfree(const_string);
+
+ return (Node *) adt;
+}
+
+static Node *
+parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
+{
+ /* check for passing non-ints */
+ Const *adt;
+ Datum lcp;
+ int32 len = tlen(tp);
+ char *cp = NULL;
+
+ char *const_string = NULL;
+ bool string_palloced = false;
+
+ Assert(IsA(expr, Const));
+
+ switch (exprType)
+ {
+ case 0: /* NULL */
+ break;
+ case INT4OID: /* int4 */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%d",
+ (int) ((Const *) expr)->constvalue);
+ break;
+ case NAMEOID: /* char16 */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%s",
+ (char *) ((Const *) expr)->constvalue);
+ break;
+ case CHAROID: /* char */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%c",
+ (char) ((Const *) expr)->constvalue);
+ break;
+ case FLOAT4OID: /* float4 */
+ {
+ float32 floatVal =
+ DatumGetFloat32(((Const *) expr)->constvalue);
+
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%f", *floatVal);
+ break;
+ }
+ case FLOAT8OID: /* float8 */
+ {
+ float64 floatVal =
+ DatumGetFloat64(((Const *) expr)->constvalue);
+
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%f", *floatVal);
+ break;
+ }
+ case CASHOID: /* money */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%ld",
+ (long) ((Const *) expr)->constvalue);
+ break;
+ case TEXTOID: /* text */
+ const_string =
+ DatumGetPointer(((Const *) expr)->constvalue);
+ const_string = (char *) textout((struct varlena *) const_string);
+ break;
+ case UNKNOWNOID: /* unknown */
+ const_string =
+ DatumGetPointer(((Const *) expr)->constvalue);
+ const_string = (char *) textout((struct varlena *) const_string);
+ break;
+ default:
+ elog(WARN, "unknown type %u ", exprType);
+ }
+
+ if (!exprType)
+ {
+ adt = makeConst(typeid(tp),
+ (Size) 0,
+ (Datum) NULL,
+ true, /* isnull */
+ false, /* was omitted */
+ false, /* not a set */
+ true /* is cast */ );
+ return ((Node *) adt);
+ }
+
+ cp = instr2(tp, const_string, typlen);
+
+
+ if (!tbyvalue(tp))
+ {
+/*
+ if (len >= 0 && len != PSIZE(cp)) {
+ char *pp;
+ pp = (char *) palloc(len);
+ memmove(pp, cp, len);
+ cp = pp;
+ }
+*/
+ lcp = PointerGetDatum(cp);
+ }
+ else
+ {
+ switch (len)
+ {
+ case 1:
+ lcp = Int8GetDatum(cp);
+ break;
+ case 2:
+ lcp = Int16GetDatum(cp);
+ break;
+ case 4:
+ lcp = Int32GetDatum(cp);
+ break;
+ default:
+ lcp = PointerGetDatum(cp);
+ break;
+ }
+ }
+
+ adt = makeConst(typeid(tp),
+ (Size) len,
+ (Datum) lcp,
+ false,
+ false, /* was omitted */
+ false, /* not a set */
+ true /* is cast */ );
+
+ /*
+ * printf("adt %s : %u %d %d\n",CString(expr),typeid(tp) , len,cp);
+ */
+ if (string_palloced)
+ pfree(const_string);
+
+ return ((Node *) adt);
+}
+
+static Aggreg *
+ParseAgg(char *aggname, Oid basetype, Node *target)
+{
+ Oid fintype;
+ Oid vartype;
+ Oid xfn1;
+ Form_pg_aggregate aggform;
+ Aggreg *aggreg;
+ HeapTuple theAggTuple;
+
+ theAggTuple = SearchSysCacheTuple(AGGNAME, PointerGetDatum(aggname),
+ ObjectIdGetDatum(basetype),
+ 0, 0);
+ if (!HeapTupleIsValid(theAggTuple))
+ {
+ elog(WARN, "aggregate %s does not exist", aggname);
+ }
+
+ aggform = (Form_pg_aggregate) GETSTRUCT(theAggTuple);
+ fintype = aggform->aggfinaltype;
+ xfn1 = aggform->aggtransfn1;
+
+ if (nodeTag(target) != T_Var && nodeTag(target) != T_Expr)
+ elog(WARN, "parser: aggregate can only be applied on an attribute or expression");
+
+ /* only aggregates with transfn1 need a base type */
+ if (OidIsValid(xfn1))
+ {
+ basetype = aggform->aggbasetype;
+ if (nodeTag(target) == T_Var)
+ vartype = ((Var *) target)->vartype;
+ else
+ vartype = ((Expr *) target)->typeOid;
+
+ if (basetype != vartype)
+ {
+ Type tp1,
+ tp2;
+
+ tp1 = get_id_type(basetype);
+ tp2 = get_id_type(vartype);
+ elog(NOTICE, "Aggregate type mismatch:");
+ elog(WARN, "%s works on %s, not %s", aggname,
+ tname(tp1), tname(tp2));
+ }
+ }
+
+ aggreg = makeNode(Aggreg);
+ aggreg->aggname = pstrdup(aggname);
+ aggreg->basetype = aggform->aggbasetype;
+ aggreg->aggtype = fintype;
+
+ aggreg->target = target;
+
+ return aggreg;
+}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.29 1997/11/02 15:25:19 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.30 1997/11/20 23:22:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
pg_operator_desc = heap_openr(OperatorRelationName);
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
- SelfTimeQual,
+ true,
nkeys,
opKey);
pg_operator_desc = heap_openr(OperatorRelationName);
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
- SelfTimeQual,
+ true,
2,
opKey);
ItemPointer iptr;
iptr = &indexRes->heap_iptr;
- tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
+ tuple = heap_fetch(heapRelation, false, iptr, &buffer);
pfree(indexRes);
if (HeapTupleIsValid(tuple))
{
ObjectIdEqualRegProcedure,
ObjectIdGetDatum(relid));
- inhscan = heap_beginscan(inhrel, 0, NowTimeQual, 1, &skey);
+ inhscan = heap_beginscan(inhrel, 0, false, 1, &skey);
while (HeapTupleIsValid(inhtup = heap_getnext(inhscan, 0, &buf)))
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.11 1997/11/10 15:17:44 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.12 1997/11/20 23:22:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
NameEqualRegProcedure, NameGetDatum(dbname));
- scan = heap_beginscan(dbrel, 0, NowTimeQual, 1, &scanKey);
+ scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
if (!HeapScanIsValid(scan))
elog(WARN, "%s: cannot begin scan of pg_database.", command);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.68 1997/11/17 16:37:24 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.69 1997/11/20 23:22:19 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
IndexElem *ielem;
RangeVar *range;
RelExpr *relexp;
- TimeRange *trange;
A_Indices *aind;
ResTarget *target;
ParamNo *paramno;
%type <str> opt_id, opt_portal_name,
before_clause, after_clause, all_Op, MathOp, opt_name, opt_unique,
- result, OptUseOp, opt_class, opt_range_start, opt_range_end,
- SpecialRuleRelation
+ result, OptUseOp, opt_class, SpecialRuleRelation
%type <str> privileges, operation_commalist, grantee
%type <chr> operation, TriggerOneEvent
%type <ielem> index_elem, func_index
%type <range> from_val
%type <relexp> relation_expr
-%type <trange> time_range
%type <target> res_target_el, res_target_el2
%type <paramno> ParamNo
$$ = makeNode(RelExpr);
$$->relname = $1;
$$->inh = FALSE;
- $$->timeRange = NULL;
}
| relation_name '*' %prec '='
{
$$ = makeNode(RelExpr);
$$->relname = $1;
$$->inh = TRUE;
- $$->timeRange = NULL;
}
- | relation_name time_range
- {
- /* time-qualified query */
- $$ = makeNode(RelExpr);
- $$->relname = $1;
- $$->inh = FALSE;
- $$->timeRange = $2;
- }
- ;
-
-/* Time travel
- * Range specification clause.
- */
-time_range: '[' opt_range_start ',' opt_range_end ']'
- {
- $$ = makeNode(TimeRange);
- $$->startDate = $2;
- $$->endDate = $4;
- elog (WARN, "time travel is no longer available");
- }
- | '[' date ']'
- {
- $$ = makeNode(TimeRange);
- $$->startDate = $2;
- $$->endDate = NULL;
- elog (WARN, "time travel is no longer available");
- }
- ;
-
-opt_range_start: date
- | /*EMPTY*/ { $$ = "epoch"; }
- ;
-
-opt_range_end: date
- | /*EMPTY*/ { $$ = "now"; }
- ;
opt_array_bounds: '[' ']' nest_array_bounds
{ $$ = lcons(makeInteger(-1), $3); }
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.22 1997/11/02 15:25:30 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.23 1997/11/20 23:22:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
addRangeTableEntry(ParseState *pstate,
char *relname,
char *refname,
- bool inh, bool inFromCl,
- TimeRange *timeRange)
+ bool inh,
+ bool inFromCl)
{
Relation relation;
RangeTblEntry *rte = makeNode(RangeTblEntry);
*/
rte->inh = inh;
- rte->timeRange = timeRange;
-
/* RelOID */
rte->relid = RelationGetRelationId(relation);
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
if (rte == NULL)
- rte = addRangeTableEntry(pstate, relname, refname, FALSE, FALSE, NULL);
+ rte = addRangeTableEntry(pstate, relname, refname, FALSE, FALSE);
rdesc = heap_open(rte->relid);
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
if (rte == NULL)
- rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE, NULL);
+ rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE);
vnum = refnameRangeTablePosn(pstate->p_rtable, refname);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.27 1997/11/17 16:59:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.28 1997/11/20 23:22:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <string.h>
#include <stdio.h>
-#include <pwd.h>
-#include <sys/param.h> /* for MAXPATHLEN */
#include "postgres.h"
-#include "parser/catalog_utils.h"
#include "parser/gramparse.h"
#include "parser/parse_query.h"
-#include "nodes/pg_list.h"
-#include "nodes/execnodes.h"
-#include "nodes/makefuncs.h"
-#include "nodes/primnodes.h"
-#include "nodes/plannodes.h"
-#include "nodes/relation.h"
-#include "utils/builtins.h"
-#include "utils/exc.h"
-#include "utils/excid.h"
-#include "utils/lsyscache.h"
#include "utils/palloc.h"
-#include "utils/syscache.h"
-#include "catalog/pg_aggregate.h"
-#include "catalog/pg_type.h"
-#include "access/heapam.h"
-#include "optimizer/clauses.h"
-
-void init_io(); /* from scan.l */
-void parser_init(Oid *typev, int nargs); /* from gram.y */
-int yyparse(); /* from gram.c */
char *parseString; /* the char* which holds the string to be
* parsed */
-char *parseCh; /* a pointer used during parsing to walk
- * down ParseString */
-
List *parsetree = NIL;
#ifdef SETS_FIXED
init_io();
- /* Set things up to read from the string, if there is one */
- parseString = (char *) palloc(strlen(str) + 1);
- memmove(parseString, str, strlen(str) + 1);
+ parseString = pstrdup(str);
parser_init(typev, nargs);
yyresult = yyparse();
clearerr(stdin);
- if (yyresult)
- { /* error */
+ if (yyresult) /* error */
return ((QueryTreeList *) NULL);
- }
queryList = parse_analyze(parsetree);
#endif
-/* not used
-#define PSIZE(PTR) (*((int32 *)(PTR) - 1))
-*/
-
-Node *
-parser_typecast(Value *expr, TypeName *typename, int typlen)
-{
- /* check for passing non-ints */
- Const *adt;
- Datum lcp;
- Type tp;
- char type_string[NAMEDATALEN];
- int32 len;
- char *cp = NULL;
- char *const_string = NULL;
- bool string_palloced = false;
-
- switch (nodeTag(expr))
- {
- case T_String:
- const_string = DatumGetPointer(expr->val.str);
- break;
- case T_Integer:
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%ld", expr->val.ival);
- break;
- default:
- elog(WARN,
- "parser_typecast: cannot cast this expression to type \"%s\"",
- typename->name);
- }
-
- if (typename->arrayBounds != NIL)
- {
- sprintf(type_string, "_%s", typename->name);
- tp = (Type) type(type_string);
- }
- else
- {
- tp = (Type) type(typename->name);
- }
-
- len = tlen(tp);
-
-#if 0 /* fix me */
- switch (CInteger(lfirst(expr)))
- {
- case INT4OID: /* int4 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%d", ((Const *) lnext(expr))->constvalue);
- break;
-
- case NAMEOID: /* char16 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%s", ((Const *) lnext(expr))->constvalue);
- break;
-
- case CHAROID: /* char */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%c", ((Const) lnext(expr))->constvalue);
- break;
-
- case FLOAT8OID: /* float8 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%f", ((Const) lnext(expr))->constvalue);
- break;
-
- case CASHOID: /* money */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%d",
- (int) ((Const *) expr)->constvalue);
- break;
-
- case TEXTOID: /* text */
- const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
- const_string = (char *) textout((struct varlena *) const_string);
- break;
-
- case UNKNOWNOID: /* unknown */
- const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
- const_string = (char *) textout((struct varlena *) const_string);
- break;
-
- default:
- elog(WARN, "unknown type %d", CInteger(lfirst(expr)));
- }
-#endif
-
- cp = instr2(tp, const_string, typlen);
-
- if (!tbyvalue(tp))
- {
-/*
- if (len >= 0 && len != PSIZE(cp)) {
- char *pp;
- pp = (char *) palloc(len);
- memmove(pp, cp, len);
- cp = pp;
- }
-*/
- lcp = PointerGetDatum(cp);
- }
- else
- {
- switch (len)
- {
- case 1:
- lcp = Int8GetDatum(cp);
- break;
- case 2:
- lcp = Int16GetDatum(cp);
- break;
- case 4:
- lcp = Int32GetDatum(cp);
- break;
- default:
- lcp = PointerGetDatum(cp);
- break;
- }
- }
-
- adt = makeConst(typeid(tp),
- len,
- (Datum) lcp,
- false,
- tbyvalue(tp),
- false, /* not a set */
- true /* is cast */ );
-
- if (string_palloced)
- pfree(const_string);
-
- return (Node *) adt;
-}
-
-Node *
-parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
-{
- /* check for passing non-ints */
- Const *adt;
- Datum lcp;
- int32 len = tlen(tp);
- char *cp = NULL;
-
- char *const_string = NULL;
- bool string_palloced = false;
-
- Assert(IsA(expr, Const));
-
- switch (exprType)
- {
- case 0: /* NULL */
- break;
- case INT4OID: /* int4 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%d",
- (int) ((Const *) expr)->constvalue);
- break;
- case NAMEOID: /* char16 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%s",
- (char *) ((Const *) expr)->constvalue);
- break;
- case CHAROID: /* char */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%c",
- (char) ((Const *) expr)->constvalue);
- break;
- case FLOAT4OID: /* float4 */
- {
- float32 floatVal =
- DatumGetFloat32(((Const *) expr)->constvalue);
-
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%f", *floatVal);
- break;
- }
- case FLOAT8OID: /* float8 */
- {
- float64 floatVal =
- DatumGetFloat64(((Const *) expr)->constvalue);
-
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%f", *floatVal);
- break;
- }
- case CASHOID: /* money */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%ld",
- (long) ((Const *) expr)->constvalue);
- break;
- case TEXTOID: /* text */
- const_string =
- DatumGetPointer(((Const *) expr)->constvalue);
- const_string = (char *) textout((struct varlena *) const_string);
- break;
- case UNKNOWNOID: /* unknown */
- const_string =
- DatumGetPointer(((Const *) expr)->constvalue);
- const_string = (char *) textout((struct varlena *) const_string);
- break;
- default:
- elog(WARN, "unknown type %u ", exprType);
- }
-
- if (!exprType)
- {
- adt = makeConst(typeid(tp),
- (Size) 0,
- (Datum) NULL,
- true, /* isnull */
- false, /* was omitted */
- false, /* not a set */
- true /* is cast */ );
- return ((Node *) adt);
- }
-
- cp = instr2(tp, const_string, typlen);
-
-
- if (!tbyvalue(tp))
- {
-/*
- if (len >= 0 && len != PSIZE(cp)) {
- char *pp;
- pp = (char *) palloc(len);
- memmove(pp, cp, len);
- cp = pp;
- }
-*/
- lcp = PointerGetDatum(cp);
- }
- else
- {
- switch (len)
- {
- case 1:
- lcp = Int8GetDatum(cp);
- break;
- case 2:
- lcp = Int16GetDatum(cp);
- break;
- case 4:
- lcp = Int32GetDatum(cp);
- break;
- default:
- lcp = PointerGetDatum(cp);
- break;
- }
- }
-
- adt = makeConst(typeid(tp),
- (Size) len,
- (Datum) lcp,
- false,
- false, /* was omitted */
- false, /* not a set */
- true /* is cast */ );
-
- /*
- * printf("adt %s : %u %d %d\n",CString(expr),typeid(tp) , len,cp);
- */
- if (string_palloced)
- pfree(const_string);
-
- return ((Node *) adt);
-}
-
-Aggreg *
-ParseAgg(char *aggname, Oid basetype, Node *target)
-{
- Oid fintype;
- Oid vartype;
- Oid xfn1;
- Form_pg_aggregate aggform;
- Aggreg *aggreg;
- HeapTuple theAggTuple;
-
- theAggTuple = SearchSysCacheTuple(AGGNAME, PointerGetDatum(aggname),
- ObjectIdGetDatum(basetype),
- 0, 0);
- if (!HeapTupleIsValid(theAggTuple))
- {
- elog(WARN, "aggregate %s does not exist", aggname);
- }
-
- aggform = (Form_pg_aggregate) GETSTRUCT(theAggTuple);
- fintype = aggform->aggfinaltype;
- xfn1 = aggform->aggtransfn1;
-
- if (nodeTag(target) != T_Var && nodeTag(target) != T_Expr)
- elog(WARN, "parser: aggregate can only be applied on an attribute or expression");
-
- /* only aggregates with transfn1 need a base type */
- if (OidIsValid(xfn1))
- {
- basetype = aggform->aggbasetype;
- if (nodeTag(target) == T_Var)
- vartype = ((Var *) target)->vartype;
- else
- vartype = ((Expr *) target)->typeOid;
-
- if (basetype != vartype)
- {
- Type tp1,
- tp2;
-
- tp1 = get_id_type(basetype);
- tp2 = get_id_type(vartype);
- elog(NOTICE, "Aggregate type mismatch:");
- elog(WARN, "%s works on %s, not %s", aggname,
- tname(tp1), tname(tp2));
- }
- }
-
- aggreg = makeNode(Aggreg);
- aggreg->aggname = pstrdup(aggname);
- aggreg->basetype = aggform->aggbasetype;
- aggreg->aggtype = fintype;
-
- aggreg->target = target;
-
- return aggreg;
-}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.29 1997/11/17 16:31:39 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.30 1997/11/20 23:22:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "parser/gramparse.h"
#include "parser/keywords.h"
#include "parser/scansup.h"
-#include "parser/sysfunc.h"
#include "parse.h"
#include "utils/builtins.h"
extern char *parseString;
-extern char *parseCh;
+static char *parseCh;
/* some versions of lex define this as a macro */
#if defined(yywrap)
letter [\200-\377_A-Za-z]
letter_or_digit [\200-\377_A-Za-z0-9]
-sysfunc SYS_{letter}{letter_or_digit}*
-
identifier {letter}{letter_or_digit}*
typecast "::"
}
-{sysfunc} {
- yylval.str = pstrdup(SystemFunctionHandler((char *)yytext));
- return (SCONST);
- }
-
{typecast} { return TYPECAST; }
{self}/-[\.0-9] {
+++ /dev/null
-/*-------------------------------------------------------------------------
- *
- * sysfunc.c--
- * process system functions and return a string result
- *
- * Notes:
- * 1) I return a string result because most of the functions cannot return any
- * normal type anyway (e.g. SYS_DATE, SYS_TIME, etc...), and the few that
- * might (SYS_UID or whatever) can just return it as a string - no problem.
- * This keeps the function flexible enough to be of good use.
- *
- * Written by Chad Robinson, chadr@brttech.com
- * Last modified: 04/27/1996
- * -------------------------------------------------------------------------
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <config.h>
-#include <postgres.h>
-#include <miscadmin.h>
-#include <parser/sysfunc.h>
-
-/*
- * Can't get much more obvious than this. Might need to replace localtime()
- * on older systems...
- */
-static char *
-Sysfunc_system_date(void)
-{
- time_t cur_time_secs;
- struct tm *cur_time_expanded;
- static char buf[12]; /* Just for safety, y'understand... */
-
- time(&cur_time_secs);
- cur_time_expanded = localtime(&cur_time_secs);
- if (EuroDates == 1)
- sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mday,
- cur_time_expanded->tm_mon + 1, cur_time_expanded->tm_year + 1900);
- else
- sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mon + 1,
- cur_time_expanded->tm_mday, cur_time_expanded->tm_year + 1900);
-
- return &buf[0];
-}
-
-static char *
-Sysfunc_system_time(void)
-{
- time_t cur_time_secs;
- struct tm *cur_time_expanded;
- static char buf[10]; /* Just for safety, y'understand... */
-
- time(&cur_time_secs);
- cur_time_expanded = localtime(&cur_time_secs);
- sprintf(buf, "%2.2d:%2.2d:%2.2d", cur_time_expanded->tm_hour,
- cur_time_expanded->tm_min, cur_time_expanded->tm_sec);
-
- return &buf[0];
-}
-
-char *
-SystemFunctionHandler(char *funct)
-{
- if (!strcmp(funct, "SYS_DATE"))
- return Sysfunc_system_date();
- if (!strcmp(funct, "SYS_TIME"))
- return Sysfunc_system_time();
- return "*unknown function*";
-}
-
-#ifdef SYSFUNC_TEST
-/*
- * Chad's rule of coding #4 - never delete a test function, even a stupid
- * one - you always need it 10 minutes after you delete it.
- */
-void
-main(void)
-{
- printf("Current system date: %s\n", SystemFunctionHandler("SYS_DATE"));
- return;
-}
-
-#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.5 1997/09/12 04:08:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.6 1997/11/20 23:22:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_rewrite_rulename,
F_CHAR16EQ, NameGetDatum(ruleName));
scanDesc = heap_beginscan(RewriteRelation,
- 0, NowTimeQual, 1, &scanKeyData);
+ 0, false, 1, &scanKeyData);
tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
F_OIDEQ,
ObjectIdGetDatum(relid));
scanDesc = heap_beginscan(RewriteRelation,
- 0, NowTimeQual, 1, &scanKeyData);
+ 0, false, 1, &scanKeyData);
for (;;)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.11 1997/10/25 05:35:55 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.12 1997/11/20 23:22:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_rewrite_rulename,
NameEqualRegProcedure, PointerGetDatum(ruleName));
scanDesc = heap_beginscan(RewriteRelation,
- 0, NowTimeQual, 1, &scanKey);
+ 0, false, 1, &scanKey);
tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.19 1997/11/02 15:25:40 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.20 1997/11/20 23:22:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* a time qual in.
*/
- htup = heap_fetch(obj_desc->heap_r, NowTimeQual,
+ htup = heap_fetch(obj_desc->heap_r, false,
&(res->heap_iptr), bufP);
} while (htup == (HeapTuple) NULL);
}
else
{
- htup = heap_fetch(obj_desc->heap_r, NowTimeQual,
+ htup = heap_fetch(obj_desc->heap_r, false,
&(obj_desc->htid), bufP);
}
if (buf != InvalidBuffer)
ReleaseBuffer(buf);
- htup = heap_fetch(hreln, NowTimeQual, &(res->heap_iptr), &buf);
+ htup = heap_fetch(hreln, false, &(res->heap_iptr), &buf);
} while (!HeapTupleIsValid(htup));
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.17 1997/09/08 21:47:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.18 1997/11/20 23:22:50 momjian Exp $
*
* NOTES
* See acl.h.
relkey[0].sk_argument = NameGetDatum(relname);
hsdp = heap_beginscan(relation,
0,
- NowTimeQual,
+ false,
(unsigned) 1,
relkey);
htp = heap_getnext(hsdp, 0, &buffer);
&relkey[0].sk_func,
&relkey[0].sk_nargs);
relkey[0].sk_argument = NameGetDatum(relname);
- hsdp = heap_beginscan(relation, 0, NowTimeQual, 1, relkey);
+ hsdp = heap_beginscan(relation, 0, false, 1, relkey);
htp = heap_getnext(hsdp, 0, (Buffer *) 0);
if (HeapTupleIsValid(htp) &&
!heap_attisnull(htp, Anum_pg_class_relacl))
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.6 1997/09/12 04:08:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.7 1997/11/20 23:22:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* the last argument should be a ScanKey, not an integer! - jolly */
/* it looks like the arguments are out of order, too */
/* but skeyData is never initialized! does this work?? - ay 2/95 */
- scan_descriptor = heap_beginscan(relation_to_scan, false, NULL, 0,
+ scan_descriptor = heap_beginscan(relation_to_scan, false, false, 0,
&skeyData);
retval = true;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.9 1997/11/15 16:32:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.10 1997/11/20 23:23:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
(RegProcedure) F_CHAR16EQ,
(Datum) proname);
- procscan = heap_beginscan(proc, 0, NowTimeQual, 1, &key);
+ procscan = heap_beginscan(proc, 0, false, 1, &key);
if (!HeapScanIsValid(procscan))
{
heap_close(proc);
(RegProcedure) F_INT4EQ,
(Datum) proid);
- procscan = heap_beginscan(proc, 0, NowTimeQual, 1, &key);
+ procscan = heap_beginscan(proc, 0, false, 1, &key);
if (!HeapScanIsValid(procscan))
{
heap_close(proc);
(RegProcedure) F_INT4EQ,
(Datum) *sp);
- typescan = heap_beginscan(type, 0, NowTimeQual, 1, &key);
+ typescan = heap_beginscan(type, 0, false, 1, &key);
if (!HeapScanIsValid(typescan))
{
heap_close(type);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.10 1997/09/08 02:31:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.11 1997/11/20 23:23:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
key[0].sk_argument = ObjectIdGetDatum(relid);
key[1].sk_argument = Int16GetDatum((int16) attnum);
key[2].sk_argument = ObjectIdGetDatum(opid);
- sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 3, key);
+ sdesc = heap_beginscan(rdesc, 0, false, 3, key);
tuple = heap_getnext(sdesc, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.7 1997/09/08 02:31:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.8 1997/11/20 23:23:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
oidKey[0].sk_argument = ObjectIdGetDatum(setoid);
pg_proc_scan = heap_beginscan(procrel,
0,
- SelfTimeQual,
+ true,
1,
oidKey);
tup = heap_getnext(pg_proc_scan, 0, &buffer);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.16 1997/09/18 20:22:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.17 1997/11/20 23:23:08 momjian Exp $
*
* Notes:
* XXX This needs to use exception.h to handle recovery when
*/
MemoryContextSwitchTo(oldcxt);
- sd = heap_beginscan(relation, 0, NowTimeQual,
+ sd = heap_beginscan(relation, 0, false,
cache->cc_nkeys, cache->cc_skey);
/* should this buffer be ReleaseBuffer'd? --djm 8/20/96 */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.28 1997/11/17 16:59:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.29 1997/11/20 23:23:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (!IsInitProcessingMode())
RelationSetLockForRead(pg_class_desc);
pg_class_scan =
- heap_beginscan(pg_class_desc, 0, NowTimeQual, 1, &key);
+ heap_beginscan(pg_class_desc, 0, false, 1, &key);
pg_class_tuple = heap_getnext(pg_class_scan, 0, &buf);
/* ----------------
*/
pg_attribute_desc = heap_openr(AttributeRelationName);
pg_attribute_scan =
- heap_beginscan(pg_attribute_desc, 0, NowTimeQual, 1, &key);
+ heap_beginscan(pg_attribute_desc, 0, false, 1, &key);
/* ----------------
* add attribute data to relation->rd_att
*/
pg_rewrite_desc = heap_openr(RewriteRelationName);
pg_rewrite_scan =
- heap_beginscan(pg_rewrite_desc, 0, NowTimeQual, 1, &key);
+ heap_beginscan(pg_rewrite_desc, 0, false, 1, &key);
pg_rewrite_tupdesc =
RelationGetTupleDescriptor(pg_rewrite_desc);
break;
iptr = &indexRes->heap_iptr;
- tuple = heap_fetch(adrel, NowTimeQual, iptr, &buffer);
+ tuple = heap_fetch(adrel, false, iptr, &buffer);
pfree(indexRes);
if (!HeapTupleIsValid(tuple))
continue;
break;
iptr = &indexRes->heap_iptr;
- tuple = heap_fetch(rcrel, NowTimeQual, iptr, &buffer);
+ tuple = heap_fetch(rcrel, false, iptr, &buffer);
pfree(indexRes);
if (!HeapTupleIsValid(tuple))
continue;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.2 1997/11/10 15:14:34 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.3 1997/11/20 23:23:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
NameEqualRegProcedure, NameGetDatum(name));
- scan = heap_beginscan(dbrel, 0, NowTimeQual, 1, &scanKey);
+ scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
if (!HeapScanIsValid(scan))
elog(WARN, "GetDatabaseInfo: cannot begin scan of %s", DatabaseRelationName);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.9 1997/11/02 15:26:17 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.10 1997/11/20 23:23:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/tqual.h"
-static int4 SelfTimeQualData;
-TimeQual SelfTimeQual = (TimeQual) &SelfTimeQualData;
-
extern bool PostgresIsInitialized;
/*
static bool HeapTupleSatisfiesNow(HeapTuple tuple);
/*
- * HeapTupleSatisfiesTimeQual --
+ * HeapTupleSatisfiesScope --
* True iff heap tuple satsifies a time qual.
*
* Note:
* Assumes heap tuple is valid.
- * Assumes time qual is valid.
*/
bool
-HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual)
+HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself)
{
if (TransactionIdEquals(tuple->t_xmax, AmiTransactionId))
return (false);
- if (qual == SelfTimeQual || heapisoverride())
- {
+ if (seeself == true || heapisoverride())
return (HeapTupleSatisfiesItself(tuple));
- }
-
- if (qual == NowTimeQual)
- {
+ else
return (HeapTupleSatisfiesNow(tuple));
- }
-
- elog(WARN, "HeapTupleSatisfiesTimeQual: illegal time qual");
-
- return (false);
}
/*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.21 1997/11/02 15:26:37 vadim Exp $
+ * $Id: heapam.h,v 1.22 1997/11/20 23:23:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern void heap_close(Relation relation);
extern HeapScanDesc
heap_beginscan(Relation relation, int atend,
- TimeQual timeQual, unsigned nkeys, ScanKey key);
+ bool seeself, unsigned nkeys, ScanKey key);
extern void heap_rescan(HeapScanDesc sdesc, bool scanFromEnd, ScanKey key);
extern void heap_endscan(HeapScanDesc sdesc);
extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw, Buffer *b);
extern HeapTuple
-heap_fetch(Relation relation, TimeQual timeQual,
- ItemPointer tid, Buffer *b);
+heap_fetch(Relation relation, bool seeself, ItemPointer tid, Buffer *b);
extern Oid heap_insert(Relation relation, HeapTuple tup);
extern int heap_delete(Relation relation, ItemPointer tid);
extern int
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: relscan.h,v 1.8 1997/09/08 21:50:56 momjian Exp $
+ * $Id: relscan.h,v 1.9 1997/11/20 23:23:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ItemPointerData rs_mntid; /* marked next tid */
ItemPointerData rs_mcd; /* marked current delta XXX ??? */
bool rs_atend; /* restart scan at end? */
- TimeQual rs_tr; /* time qualification */
+ bool rs_seeself; /* see self or not */
uint16 rs_cdelta; /* current delta in chain */
uint16 rs_nkeys; /* number of attributes in keys */
ScanKey rs_key; /* key descriptors */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: valid.h,v 1.9 1997/11/02 15:26:46 vadim Exp $
+ * $Id: valid.h,v 1.10 1997/11/20 23:23:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
relation, \
buffer, \
disk_page, \
- qual, \
+ seeself, \
nKeys, \
key, \
result) \
{ \
uint16 _infomask = _tuple->t_infomask; \
\
- _res = HeapTupleSatisfiesTimeQual(_tuple, (qual)); \
+ _res = HeapTupleSatisfiesVisibility(_tuple, (seeself)); \
if (_tuple->t_infomask != _infomask) \
SetBufferCommitInfoNeedsSave(buffer); \
if (_res) \
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: executor.h,v 1.14 1997/09/27 14:37:21 momjian Exp $
+ * $Id: executor.h,v 1.15 1997/11/20 23:23:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
extern void
ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
- ScanDirection dir, TimeQual timeRange,
- Relation *returnRelation, Pointer *returnScanDesc);
+ ScanDirection dir, Relation *returnRelation,
+ Pointer *returnScanDesc);
extern void ExecCloseR(Plan *node);
extern void ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent);
extern HeapScanDesc
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.30 1997/11/07 06:38:38 thomas Exp $
+ * $Id: parsenodes.h,v 1.31 1997/11/20 23:23:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char *val;
} ParamString;
-/*
- * TimeRange - specifies a time range
- */
-typedef struct TimeRange
-{
- NodeTag type;
- char *startDate;
- char *endDate; /* snapshot if NULL */
-} TimeRange;
-
/*
* RelExpr - relation expressions
*/
NodeTag type;
char *relname; /* the relation name */
bool inh; /* inheritance query */
- TimeRange *timeRange; /* the time range */
} RelExpr;
/*
{
NodeTag type;
char *relname; /* real name of the relation */
- TimeRange *timeRange; /* time range */
char *refname; /* the reference name (specified in the
* from clause) */
Oid relid;
bool inh; /* inheritance? */
bool archive; /* filled in by plan_archive */
bool inFromCl; /* comes from From Clause */
- TimeQual timeQual; /* filled in by pg_plan */
} RangeTblEntry;
/*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: prep.h,v 1.5 1997/09/08 21:53:30 momjian Exp $
+ * $Id: prep.h,v 1.6 1997/11/20 23:23:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <nodes/plannodes.h>
#include <nodes/parsenodes.h>
-/*
- * prototypes for archive.h
- */
-extern void plan_archive(List *rt);
-extern List *find_archive_rels(Oid relid);
-
/*
* prototypes for prepqual.h
*/
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_query.h,v 1.13 1997/11/02 15:27:08 vadim Exp $
+ * $Id: parse_query.h,v 1.14 1997/11/20 23:23:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern RangeTblEntry *
addRangeTableEntry(ParseState *pstate,
char *relname, char *refname,
- bool inh, bool inFromCl,
- TimeRange *timeRange);
+ bool inh, bool inFromCl);
extern List *
expandAll(ParseState *pstate, char *relname, char *refname,
int *this_resno);
extern void param_type_init(Oid *typev, int nargs);
extern Oid param_type(int t);
-/* parser.c (was ylib.c) */
extern QueryTreeList *parser(char *str, Oid *typev, int nargs);
-extern Node *parser_typecast(Value *expr, TypeName *typename, int typlen);
-extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen);
-extern Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target);
-extern void
-handleTargetColname(ParseState *pstate, char **resname,
+
+extern void handleTargetColname(ParseState *pstate, char **resname,
char *refname, char *colname);
/*
-/*-------------------------------------------------------------------------
- *
- * sysfunc.h--
- * support for system functions
- *
- * -------------------------------------------------------------------------
- */
-
-extern char *SystemFunctionHandler(char *funct);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tqual.h,v 1.10 1997/11/02 15:27:14 vadim Exp $
+ * $Id: tqual.h,v 1.11 1997/11/20 23:24:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <access/htup.h>
-typedef Pointer TimeQual;
-
-/* Tuples valid as of StartTransactionCommand */
-#define NowTimeQual ((TimeQual) NULL)
-
/* As above, plus updates in this command */
-extern TimeQual SelfTimeQual;
extern void setheapoverride(bool on);
extern bool heapisoverride(void);
-extern bool HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual);
+extern bool HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself);
#endif /* TQUAL_H */