Remove all time travel stuff. Small parser cleanup.
This commit is contained in:
parent
e075271c17
commit
e9e1ff226f
@ -169,7 +169,7 @@ gistbuild(Relation heap,
|
|||||||
econtext = NULL;
|
econtext = NULL;
|
||||||
}
|
}
|
||||||
#endif /* OMIT_PARTIAL_INDEX */
|
#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);
|
htup = heap_getnext(scan, 0, &buffer);
|
||||||
|
|
||||||
/* int the tuples as we insert them */
|
/* int the tuples as we insert them */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* This file contains only the public interface routines.
|
* This file contains only the public interface routines.
|
||||||
@ -121,7 +121,7 @@ hashbuild(Relation heap,
|
|||||||
#endif /* OMIT_PARTIAL_INDEX */
|
#endif /* OMIT_PARTIAL_INDEX */
|
||||||
|
|
||||||
/* start a heap scan */
|
/* 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);
|
htup = heap_getnext(hscan, 0, &buffer);
|
||||||
|
|
||||||
/* build the index */
|
/* build the index */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* INTERFACE ROUTINES
|
||||||
@ -215,7 +215,7 @@ heapgettup(Relation relation,
|
|||||||
ItemPointer tid,
|
ItemPointer tid,
|
||||||
int dir,
|
int dir,
|
||||||
Buffer *b,
|
Buffer *b,
|
||||||
TimeQual timeQual,
|
bool seeself,
|
||||||
int nkeys,
|
int nkeys,
|
||||||
ScanKey key)
|
ScanKey key)
|
||||||
{
|
{
|
||||||
@ -254,19 +254,11 @@ heapgettup(Relation relation,
|
|||||||
elog(DEBUG, "heapgettup(%.16s, tid=0x%x, dir=%d, ...)",
|
elog(DEBUG, "heapgettup(%.16s, tid=0x%x, dir=%d, ...)",
|
||||||
RelationGetRelationName(relation), tid, dir);
|
RelationGetRelationName(relation), tid, dir);
|
||||||
}
|
}
|
||||||
elog(DEBUG, "heapgettup(..., b=0x%x, timeQ=0x%x, nkeys=%d, key=0x%x",
|
elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", b, nkeys, key);
|
||||||
b, timeQual, nkeys, key);
|
|
||||||
if (timeQual == SelfTimeQual)
|
elog(DEBUG, "heapgettup: relation(%c)=`%.16s', %s",
|
||||||
{
|
|
||||||
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,
|
relation->rd_rel->relkind, &relation->rd_rel->relname,
|
||||||
timeQual);
|
(seeself == true) ? "SeeSelf" : "NoSeeSelf");
|
||||||
}
|
|
||||||
#endif /* !defined(HEAPDEBUGALL) */
|
#endif /* !defined(HEAPDEBUGALL) */
|
||||||
|
|
||||||
if (!ItemPointerIsValid(tid))
|
if (!ItemPointerIsValid(tid))
|
||||||
@ -303,9 +295,7 @@ heapgettup(Relation relation,
|
|||||||
|
|
||||||
#ifndef NO_BUFFERISVALID
|
#ifndef NO_BUFFERISVALID
|
||||||
if (!BufferIsValid(*b))
|
if (!BufferIsValid(*b))
|
||||||
{
|
|
||||||
elog(WARN, "heapgettup: failed ReadBuffer");
|
elog(WARN, "heapgettup: failed ReadBuffer");
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dp = (Page) BufferGetPage(*b);
|
dp = (Page) BufferGetPage(*b);
|
||||||
@ -430,7 +420,7 @@ heapgettup(Relation relation,
|
|||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
HeapTupleSatisfies(lpp, relation, *b, (PageHeader) dp,
|
HeapTupleSatisfies(lpp, relation, *b, (PageHeader) dp,
|
||||||
timeQual, nkeys, key, rtup);
|
seeself, nkeys, key, rtup);
|
||||||
if (rtup != NULL)
|
if (rtup != NULL)
|
||||||
{
|
{
|
||||||
ItemPointer iptr = &(rtup->t_ctid);
|
ItemPointer iptr = &(rtup->t_ctid);
|
||||||
@ -618,7 +608,7 @@ heap_close(Relation relation)
|
|||||||
HeapScanDesc
|
HeapScanDesc
|
||||||
heap_beginscan(Relation relation,
|
heap_beginscan(Relation relation,
|
||||||
int atend,
|
int atend,
|
||||||
TimeQual timeQual,
|
bool seeself,
|
||||||
unsigned nkeys,
|
unsigned nkeys,
|
||||||
ScanKey key)
|
ScanKey key)
|
||||||
{
|
{
|
||||||
@ -646,9 +636,7 @@ heap_beginscan(Relation relation,
|
|||||||
|
|
||||||
/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
|
/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
|
||||||
if (relation->rd_rel->relkind == RELKIND_UNCATALOGED)
|
if (relation->rd_rel->relkind == RELKIND_UNCATALOGED)
|
||||||
{
|
seeself = true;
|
||||||
timeQual = SelfTimeQual;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* increment relation ref count while scanning relation
|
* increment relation ref count while scanning relation
|
||||||
@ -666,24 +654,19 @@ heap_beginscan(Relation relation,
|
|||||||
sdesc->rs_rd = relation;
|
sdesc->rs_rd = relation;
|
||||||
|
|
||||||
if (nkeys)
|
if (nkeys)
|
||||||
{
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we do this here instead of in initsdesc() because heap_rescan
|
* we do this here instead of in initsdesc() because heap_rescan
|
||||||
* also calls initsdesc() and we don't want to allocate memory
|
* also calls initsdesc() and we don't want to allocate memory
|
||||||
* again
|
* again
|
||||||
*/
|
*/
|
||||||
sdesc->rs_key = (ScanKey) palloc(sizeof(ScanKeyData) * nkeys);
|
sdesc->rs_key = (ScanKey) palloc(sizeof(ScanKeyData) * nkeys);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
sdesc->rs_key = NULL;
|
sdesc->rs_key = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
initsdesc(sdesc, relation, atend, nkeys, key);
|
initsdesc(sdesc, relation, atend, nkeys, key);
|
||||||
|
|
||||||
sdesc->rs_atend = atend;
|
sdesc->rs_atend = atend;
|
||||||
sdesc->rs_tr = timeQual;
|
sdesc->rs_seeself = seeself;
|
||||||
sdesc->rs_nkeys = (short) nkeys;
|
sdesc->rs_nkeys = (short) nkeys;
|
||||||
|
|
||||||
return (sdesc);
|
return (sdesc);
|
||||||
@ -900,7 +883,7 @@ heap_getnext(HeapScanDesc scandesc,
|
|||||||
iptr,
|
iptr,
|
||||||
-1,
|
-1,
|
||||||
&(sdesc->rs_cbuf),
|
&(sdesc->rs_cbuf),
|
||||||
sdesc->rs_tr,
|
sdesc->rs_seeself,
|
||||||
sdesc->rs_nkeys,
|
sdesc->rs_nkeys,
|
||||||
sdesc->rs_key);
|
sdesc->rs_key);
|
||||||
}
|
}
|
||||||
@ -987,7 +970,7 @@ heap_getnext(HeapScanDesc scandesc,
|
|||||||
iptr,
|
iptr,
|
||||||
1,
|
1,
|
||||||
&sdesc->rs_cbuf,
|
&sdesc->rs_cbuf,
|
||||||
sdesc->rs_tr,
|
sdesc->rs_seeself,
|
||||||
sdesc->rs_nkeys,
|
sdesc->rs_nkeys,
|
||||||
sdesc->rs_key);
|
sdesc->rs_key);
|
||||||
}
|
}
|
||||||
@ -1032,7 +1015,7 @@ heap_getnext(HeapScanDesc scandesc,
|
|||||||
*/
|
*/
|
||||||
HeapTuple
|
HeapTuple
|
||||||
heap_fetch(Relation relation,
|
heap_fetch(Relation relation,
|
||||||
TimeQual timeQual,
|
bool seeself,
|
||||||
ItemPointer tid,
|
ItemPointer tid,
|
||||||
Buffer *b)
|
Buffer *b)
|
||||||
{
|
{
|
||||||
@ -1094,7 +1077,7 @@ heap_fetch(Relation relation,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
HeapTupleSatisfies(lp, relation, buffer, dp,
|
HeapTupleSatisfies(lp, relation, buffer, dp,
|
||||||
timeQual, 0, (ScanKey) NULL, tuple);
|
seeself, 0, (ScanKey) NULL, tuple);
|
||||||
|
|
||||||
if (tuple == NULL)
|
if (tuple == NULL)
|
||||||
{
|
{
|
||||||
@ -1259,7 +1242,7 @@ heap_delete(Relation relation, ItemPointer tid)
|
|||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
HeapTupleSatisfies(lp, relation, b, dp,
|
HeapTupleSatisfies(lp, relation, b, dp,
|
||||||
NowTimeQual, 0, (ScanKey) NULL, tp);
|
false, 0, (ScanKey) NULL, tp);
|
||||||
if (!tp)
|
if (!tp)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1395,7 +1378,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
|
|||||||
relation,
|
relation,
|
||||||
buffer,
|
buffer,
|
||||||
(PageHeader) dp,
|
(PageHeader) dp,
|
||||||
NowTimeQual,
|
false,
|
||||||
0,
|
0,
|
||||||
(ScanKey) NULL,
|
(ScanKey) NULL,
|
||||||
tuple);
|
tuple);
|
||||||
@ -1492,7 +1475,7 @@ heap_markpos(HeapScanDesc sdesc)
|
|||||||
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
|
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
|
||||||
-1,
|
-1,
|
||||||
&sdesc->rs_pbuf,
|
&sdesc->rs_pbuf,
|
||||||
sdesc->rs_tr,
|
sdesc->rs_seeself,
|
||||||
sdesc->rs_nkeys,
|
sdesc->rs_nkeys,
|
||||||
sdesc->rs_key);
|
sdesc->rs_key);
|
||||||
|
|
||||||
@ -1506,7 +1489,7 @@ heap_markpos(HeapScanDesc sdesc)
|
|||||||
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
|
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
|
||||||
1,
|
1,
|
||||||
&sdesc->rs_nbuf,
|
&sdesc->rs_nbuf,
|
||||||
sdesc->rs_tr,
|
sdesc->rs_seeself,
|
||||||
sdesc->rs_nkeys,
|
sdesc->rs_nkeys,
|
||||||
sdesc->rs_key);
|
sdesc->rs_key);
|
||||||
}
|
}
|
||||||
@ -1594,7 +1577,7 @@ heap_restrpos(HeapScanDesc sdesc)
|
|||||||
&sdesc->rs_mptid,
|
&sdesc->rs_mptid,
|
||||||
0,
|
0,
|
||||||
&sdesc->rs_pbuf,
|
&sdesc->rs_pbuf,
|
||||||
NowTimeQual,
|
false,
|
||||||
0,
|
0,
|
||||||
(ScanKey) NULL);
|
(ScanKey) NULL);
|
||||||
}
|
}
|
||||||
@ -1610,7 +1593,7 @@ heap_restrpos(HeapScanDesc sdesc)
|
|||||||
&sdesc->rs_mctid,
|
&sdesc->rs_mctid,
|
||||||
0,
|
0,
|
||||||
&sdesc->rs_cbuf,
|
&sdesc->rs_cbuf,
|
||||||
NowTimeQual,
|
false,
|
||||||
0,
|
0,
|
||||||
(ScanKey) NULL);
|
(ScanKey) NULL);
|
||||||
}
|
}
|
||||||
@ -1626,7 +1609,7 @@ heap_restrpos(HeapScanDesc sdesc)
|
|||||||
&sdesc->rs_mntid,
|
&sdesc->rs_mntid,
|
||||||
0,
|
0,
|
||||||
&sdesc->rs_nbuf,
|
&sdesc->rs_nbuf,
|
||||||
NowTimeQual,
|
false,
|
||||||
0,
|
0,
|
||||||
(ScanKey) NULL);
|
(ScanKey) NULL);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -508,7 +508,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
|
|||||||
ObjectIdEqualRegProcedure,
|
ObjectIdEqualRegProcedure,
|
||||||
ObjectIdGetDatum(operatorObjectId));
|
ObjectIdGetDatum(operatorObjectId));
|
||||||
|
|
||||||
scan = heap_beginscan(operatorRelation, false, NowTimeQual,
|
scan = heap_beginscan(operatorRelation, false, false,
|
||||||
1, &scanKeyData);
|
1, &scanKeyData);
|
||||||
|
|
||||||
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||||
@ -564,7 +564,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
|||||||
ObjectIdGetDatum(indexObjectId));
|
ObjectIdGetDatum(indexObjectId));
|
||||||
|
|
||||||
relation = heap_openr(IndexRelationName);
|
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);
|
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
elog(WARN, "IndexSupportInitialize: corrupted catalogs");
|
elog(WARN, "IndexSupportInitialize: corrupted catalogs");
|
||||||
@ -628,7 +628,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
|||||||
entry[1].sk_argument =
|
entry[1].sk_argument =
|
||||||
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
|
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),
|
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
|
||||||
HeapTupleIsValid(tuple))
|
HeapTupleIsValid(tuple))
|
||||||
@ -671,7 +671,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
|||||||
for (strategy = 1; strategy <= maxStrategyNumber; strategy++)
|
for (strategy = 1; strategy <= maxStrategyNumber; strategy++)
|
||||||
ScanKeyEntrySetIllegal(StrategyMapGetScanKeyEntry(map, 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),
|
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
|
||||||
HeapTupleIsValid(tuple))
|
HeapTupleIsValid(tuple))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -120,7 +120,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
|
|||||||
{ /* they're equal */
|
{ /* they're equal */
|
||||||
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
|
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
|
||||||
itup = &(btitem->bti_itup);
|
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)
|
if (htup != (HeapTuple) NULL)
|
||||||
{ /* it is a duplicate */
|
{ /* it is a duplicate */
|
||||||
elog(WARN, "Cannot insert a duplicate key into a unique index.");
|
elog(WARN, "Cannot insert a duplicate key into a unique index.");
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* This file contains only the public interface routines.
|
* This file contains only the public interface routines.
|
||||||
@ -153,7 +153,7 @@ btbuild(Relation heap,
|
|||||||
#endif /* OMIT_PARTIAL_INDEX */
|
#endif /* OMIT_PARTIAL_INDEX */
|
||||||
|
|
||||||
/* start a heap scan */
|
/* 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);
|
htup = heap_getnext(hscan, 0, &buffer);
|
||||||
|
|
||||||
/* build the index */
|
/* build the index */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -164,7 +164,7 @@ rtbuild(Relation heap,
|
|||||||
slot = NULL;
|
slot = NULL;
|
||||||
}
|
}
|
||||||
#endif /* OMIT_PARTIAL_INDEX */
|
#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);
|
htup = heap_getnext(scan, 0, &buffer);
|
||||||
|
|
||||||
/* count the tuples as we insert them */
|
/* count the tuples as we insert them */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -487,14 +487,14 @@ boot_openrel(char *relname)
|
|||||||
{
|
{
|
||||||
StartPortalAllocMode(DefaultAllocMode, 0);
|
StartPortalAllocMode(DefaultAllocMode, 0);
|
||||||
rdesc = heap_openr(TypeRelationName);
|
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);
|
for (i = 0; PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)); ++i);
|
||||||
heap_endscan(sdesc);
|
heap_endscan(sdesc);
|
||||||
app = Typ = ALLOC(struct typmap *, i + 1);
|
app = Typ = ALLOC(struct typmap *, i + 1);
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
*app++ = ALLOC(struct typmap, 1);
|
*app++ = ALLOC(struct typmap, 1);
|
||||||
*app = (struct typmap *) NULL;
|
*app = (struct typmap *) NULL;
|
||||||
sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
|
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
|
||||||
app = Typ;
|
app = Typ;
|
||||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||||
{
|
{
|
||||||
@ -852,7 +852,7 @@ gettype(char *type)
|
|||||||
if (DebugMode)
|
if (DebugMode)
|
||||||
printf("bootstrap.c: External Type: %s\n", type);
|
printf("bootstrap.c: External Type: %s\n", type);
|
||||||
rdesc = heap_openr(TypeRelationName);
|
rdesc = heap_openr(TypeRelationName);
|
||||||
sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
|
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||||
++i;
|
++i;
|
||||||
@ -861,7 +861,7 @@ gettype(char *type)
|
|||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
*app++ = ALLOC(struct typmap, 1);
|
*app++ = ALLOC(struct typmap, 1);
|
||||||
*app = (struct typmap *) NULL;
|
*app = (struct typmap *) NULL;
|
||||||
sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
|
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
|
||||||
app = Typ;
|
app = Typ;
|
||||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* INTERFACE ROUTINES
|
||||||
* heap_creatr() - Create an uncataloged heap relation
|
* heap_creatr() - Create an uncataloged heap relation
|
||||||
@ -500,7 +500,7 @@ RelationAlreadyExists(Relation pg_class_desc, char relname[])
|
|||||||
*/
|
*/
|
||||||
pg_class_scan = heap_beginscan(pg_class_desc,
|
pg_class_scan = heap_beginscan(pg_class_desc,
|
||||||
0,
|
0,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&key);
|
&key);
|
||||||
|
|
||||||
@ -903,7 +903,7 @@ RelationRemoveInheritance(Relation relation)
|
|||||||
|
|
||||||
scan = heap_beginscan(catalogRelation,
|
scan = heap_beginscan(catalogRelation,
|
||||||
false,
|
false,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&entry);
|
&entry);
|
||||||
|
|
||||||
@ -931,7 +931,7 @@ RelationRemoveInheritance(Relation relation)
|
|||||||
|
|
||||||
scan = heap_beginscan(catalogRelation,
|
scan = heap_beginscan(catalogRelation,
|
||||||
false,
|
false,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&entry);
|
&entry);
|
||||||
|
|
||||||
@ -959,7 +959,7 @@ RelationRemoveInheritance(Relation relation)
|
|||||||
|
|
||||||
scan = heap_beginscan(catalogRelation,
|
scan = heap_beginscan(catalogRelation,
|
||||||
false,
|
false,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&entry);
|
&entry);
|
||||||
|
|
||||||
@ -998,7 +998,7 @@ RelationRemoveIndexes(Relation relation)
|
|||||||
|
|
||||||
scan = heap_beginscan(indexRelation,
|
scan = heap_beginscan(indexRelation,
|
||||||
false,
|
false,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&entry);
|
&entry);
|
||||||
|
|
||||||
@ -1046,7 +1046,7 @@ DeletePgRelationTuple(Relation rdesc)
|
|||||||
|
|
||||||
pg_class_scan = heap_beginscan(pg_class_desc,
|
pg_class_scan = heap_beginscan(pg_class_desc,
|
||||||
0,
|
0,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&key);
|
&key);
|
||||||
|
|
||||||
@ -1110,7 +1110,7 @@ DeletePgAttributeTuples(Relation rdesc)
|
|||||||
|
|
||||||
pg_attribute_scan = heap_beginscan(pg_attribute_desc,
|
pg_attribute_scan = heap_beginscan(pg_attribute_desc,
|
||||||
0,
|
0,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&key);
|
&key);
|
||||||
|
|
||||||
@ -1179,7 +1179,7 @@ DeletePgTypeTuple(Relation rdesc)
|
|||||||
|
|
||||||
pg_type_scan = heap_beginscan(pg_type_desc,
|
pg_type_scan = heap_beginscan(pg_type_desc,
|
||||||
0,
|
0,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&key);
|
&key);
|
||||||
|
|
||||||
@ -1215,7 +1215,7 @@ DeletePgTypeTuple(Relation rdesc)
|
|||||||
|
|
||||||
pg_attribute_scan = heap_beginscan(pg_attribute_desc,
|
pg_attribute_scan = heap_beginscan(pg_attribute_desc,
|
||||||
0,
|
0,
|
||||||
NowTimeQual,
|
false,
|
||||||
1,
|
1,
|
||||||
&attkey);
|
&attkey);
|
||||||
|
|
||||||
@ -1670,7 +1670,7 @@ RemoveAttrDefault(Relation rel)
|
|||||||
|
|
||||||
RelationSetLockForWrite(adrel);
|
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))
|
while (tup = heap_getnext(adscan, 0, (Buffer *) NULL), PointerIsValid(tup))
|
||||||
heap_delete(adrel, &tup->t_ctid);
|
heap_delete(adrel, &tup->t_ctid);
|
||||||
@ -1697,7 +1697,7 @@ RemoveRelCheck(Relation rel)
|
|||||||
|
|
||||||
RelationSetLockForWrite(rcrel);
|
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))
|
while (tup = heap_getnext(rcscan, 0, (Buffer *) NULL), PointerIsValid(tup))
|
||||||
heap_delete(rcrel, &tup->t_ctid);
|
heap_delete(rcrel, &tup->t_ctid);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* INTERFACE ROUTINES
|
||||||
@ -178,7 +178,7 @@ RelationNameGetObjectId(char *relationName,
|
|||||||
NameEqualRegProcedure,
|
NameEqualRegProcedure,
|
||||||
PointerGetDatum(relationName));
|
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
|
* if we find the named relation, fetch its relation id
|
||||||
@ -505,7 +505,7 @@ AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId)
|
|||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
pg_am_desc = heap_openr(AccessMethodRelationName);
|
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);
|
pg_am_tuple = heap_getnext(pg_am_scan, 0, (Buffer *) NULL);
|
||||||
|
|
||||||
@ -952,7 +952,7 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
|
|||||||
ObjectIdEqualRegProcedure,
|
ObjectIdEqualRegProcedure,
|
||||||
ObjectIdGetDatum(indexoid));
|
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);
|
tuple = heap_getnext(scan, 0, &buffer);
|
||||||
heap_endscan(scan);
|
heap_endscan(scan);
|
||||||
|
|
||||||
@ -1249,7 +1249,7 @@ index_destroy(Oid indexId)
|
|||||||
ObjectIdEqualRegProcedure,
|
ObjectIdEqualRegProcedure,
|
||||||
ObjectIdGetDatum(indexId));;
|
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);
|
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
|
||||||
|
|
||||||
AssertState(HeapTupleIsValid(tuple));
|
AssertState(HeapTupleIsValid(tuple));
|
||||||
@ -1266,7 +1266,7 @@ index_destroy(Oid indexId)
|
|||||||
|
|
||||||
entry.sk_attno = Anum_pg_attribute_attrelid;
|
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),
|
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
|
||||||
HeapTupleIsValid(tuple))
|
HeapTupleIsValid(tuple))
|
||||||
@ -1285,7 +1285,7 @@ index_destroy(Oid indexId)
|
|||||||
|
|
||||||
entry.sk_attno = Anum_pg_index_indexrelid;
|
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);
|
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
{
|
{
|
||||||
@ -1415,7 +1415,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
|
|||||||
key[0].sk_argument = ObjectIdGetDatum(relid);
|
key[0].sk_argument = ObjectIdGetDatum(relid);
|
||||||
|
|
||||||
pg_class_scan =
|
pg_class_scan =
|
||||||
heap_beginscan(pg_class, 0, NowTimeQual, 1, key);
|
heap_beginscan(pg_class, 0, false, 1, key);
|
||||||
|
|
||||||
if (!HeapScanIsValid(pg_class_scan))
|
if (!HeapScanIsValid(pg_class_scan))
|
||||||
{
|
{
|
||||||
@ -1611,7 +1611,7 @@ DefaultBuild(Relation heapRelation,
|
|||||||
*/
|
*/
|
||||||
scan = heap_beginscan(heapRelation, /* relation */
|
scan = heap_beginscan(heapRelation, /* relation */
|
||||||
0, /* start at end */
|
0, /* start at end */
|
||||||
NowTimeQual, /* time range */
|
false, /* seeself */
|
||||||
0, /* number of keys */
|
0, /* number of keys */
|
||||||
(ScanKey) NULL); /* scan key */
|
(ScanKey) NULL); /* scan key */
|
||||||
|
|
||||||
@ -1825,7 +1825,7 @@ IndexIsUniqueNoCache(Oid indexId)
|
|||||||
(RegProcedure) ObjectIdEqualRegProcedure,
|
(RegProcedure) ObjectIdEqualRegProcedure,
|
||||||
ObjectIdGetDatum(indexId));
|
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);
|
tuple = heap_getnext(scandesc, 0, NULL);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -242,7 +242,7 @@ CatalogIndexFetchTuple(Relation heapRelation,
|
|||||||
ItemPointer iptr;
|
ItemPointer iptr;
|
||||||
|
|
||||||
iptr = &indexRes->heap_iptr;
|
iptr = &indexRes->heap_iptr;
|
||||||
tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
|
tuple = heap_fetch(heapRelation, false, iptr, &buffer);
|
||||||
pfree(indexRes);
|
pfree(indexRes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -394,7 +394,7 @@ ProcedureNameIndexScan(Relation heapRelation,
|
|||||||
ItemPointer iptr;
|
ItemPointer iptr;
|
||||||
|
|
||||||
iptr = &indexRes->heap_iptr;
|
iptr = &indexRes->heap_iptr;
|
||||||
tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
|
tuple = heap_fetch(heapRelation, false, iptr, &buffer);
|
||||||
pfree(indexRes);
|
pfree(indexRes);
|
||||||
if (HeapTupleIsValid(tuple))
|
if (HeapTupleIsValid(tuple))
|
||||||
{
|
{
|
||||||
@ -459,7 +459,7 @@ ProcedureSrcIndexScan(Relation heapRelation, text *procSrc)
|
|||||||
ItemPointer iptr;
|
ItemPointer iptr;
|
||||||
|
|
||||||
iptr = &indexRes->heap_iptr;
|
iptr = &indexRes->heap_iptr;
|
||||||
tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
|
tuple = heap_fetch(heapRelation, false, iptr, &buffer);
|
||||||
pfree(indexRes);
|
pfree(indexRes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* these routines moved here from commands/define.c and somewhat cleaned up.
|
* these routines moved here from commands/define.c and somewhat cleaned up.
|
||||||
@ -116,7 +116,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
|
|||||||
*/
|
*/
|
||||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
3,
|
3,
|
||||||
opKey);
|
opKey);
|
||||||
|
|
||||||
@ -697,7 +697,7 @@ OperatorDef(char *operatorName,
|
|||||||
|
|
||||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
3,
|
3,
|
||||||
opKey);
|
opKey);
|
||||||
|
|
||||||
@ -796,7 +796,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
|
|||||||
|
|
||||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
1,
|
1,
|
||||||
opKey);
|
opKey);
|
||||||
|
|
||||||
@ -886,7 +886,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
|
|||||||
|
|
||||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
1,
|
1,
|
||||||
opKey);
|
opKey);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
|
|||||||
|
|
||||||
scan = heap_beginscan(pg_type_desc,
|
scan = heap_beginscan(pg_type_desc,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
1,
|
1,
|
||||||
typeKey);
|
typeKey);
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ TypeCreate(char *typeName,
|
|||||||
typeKey[0].sk_argument = PointerGetDatum(typeName);
|
typeKey[0].sk_argument = PointerGetDatum(typeName);
|
||||||
pg_type_scan = heap_beginscan(pg_type_desc,
|
pg_type_scan = heap_beginscan(pg_type_desc,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
1,
|
1,
|
||||||
typeKey);
|
typeKey);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -206,7 +206,7 @@ Async_Notify(char *relname)
|
|||||||
lRel = heap_openr(ListenerRelationName);
|
lRel = heap_openr(ListenerRelationName);
|
||||||
tdesc = RelationGetTupleDescriptor(lRel);
|
tdesc = RelationGetTupleDescriptor(lRel);
|
||||||
RelationSetLockForWrite(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] = ' ';
|
nulls[0] = nulls[1] = nulls[2] = ' ';
|
||||||
repl[0] = repl[1] = repl[2] = ' ';
|
repl[0] = repl[1] = repl[2] = ' ';
|
||||||
@ -287,7 +287,7 @@ Async_NotifyAtCommit()
|
|||||||
Int32GetDatum(1));
|
Int32GetDatum(1));
|
||||||
lRel = heap_openr(ListenerRelationName);
|
lRel = heap_openr(ListenerRelationName);
|
||||||
RelationSetLockForWrite(lRel);
|
RelationSetLockForWrite(lRel);
|
||||||
sRel = heap_beginscan(lRel, 0, NowTimeQual, 1, &key);
|
sRel = heap_beginscan(lRel, 0, false, 1, &key);
|
||||||
tdesc = RelationGetTupleDescriptor(lRel);
|
tdesc = RelationGetTupleDescriptor(lRel);
|
||||||
ourpid = getpid();
|
ourpid = getpid();
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ Async_Listen(char *relname, int pid)
|
|||||||
|
|
||||||
/* is someone already listening. One listener per relation */
|
/* is someone already listening. One listener per relation */
|
||||||
tdesc = RelationGetTupleDescriptor(lDesc);
|
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)))
|
while (HeapTupleIsValid(htup = heap_getnext(s, 0, &b)))
|
||||||
{
|
{
|
||||||
d = heap_getattr(htup, b, Anum_pg_listener_relname, tdesc,
|
d = heap_getattr(htup, b, Anum_pg_listener_relname, tdesc,
|
||||||
@ -599,7 +599,7 @@ Async_NotifyFrontEnd()
|
|||||||
lRel = heap_openr(ListenerRelationName);
|
lRel = heap_openr(ListenerRelationName);
|
||||||
RelationSetLockForWrite(lRel);
|
RelationSetLockForWrite(lRel);
|
||||||
tdesc = RelationGetTupleDescriptor(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] = ' ';
|
nulls[0] = nulls[1] = nulls[2] = ' ';
|
||||||
repl[0] = repl[1] = repl[2] = ' ';
|
repl[0] = repl[1] = repl[2] = ' ';
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -355,7 +355,7 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
|
|||||||
{
|
{
|
||||||
|
|
||||||
HeapTid = &ScanResult->heap_iptr;
|
HeapTid = &ScanResult->heap_iptr;
|
||||||
LocalHeapTuple = heap_fetch(LocalOldHeap, 0, HeapTid, &LocalBuffer);
|
LocalHeapTuple = heap_fetch(LocalOldHeap, false, HeapTid, &LocalBuffer);
|
||||||
OIDNewHeapInsert =
|
OIDNewHeapInsert =
|
||||||
heap_insert(LocalNewHeap, LocalHeapTuple);
|
heap_insert(LocalNewHeap, LocalHeapTuple);
|
||||||
pfree(ScanResult);
|
pfree(ScanResult);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* The PortalExecutorHeapMemory crap needs to be eliminated
|
* The PortalExecutorHeapMemory crap needs to be eliminated
|
||||||
@ -440,7 +440,7 @@ PerformAddAttribute(char *relationName,
|
|||||||
* XXX use syscache here as an optimization
|
* XXX use syscache here as an optimization
|
||||||
*/
|
*/
|
||||||
key[1].sk_argument = (Datum) colDef->colname;
|
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);
|
tup = heap_getnext(attsdesc, 0, (Buffer *) NULL);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -224,7 +224,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
|
|||||||
int32 ntuples;
|
int32 ntuples;
|
||||||
TupleDesc tupDesc;
|
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_count = rel->rd_att->natts;
|
||||||
attr = rel->rd_att->attrs;
|
attr = rel->rd_att->attrs;
|
||||||
@ -921,7 +921,7 @@ GetIndexRelations(Oid main_relation_oid,
|
|||||||
bool isnull;
|
bool isnull;
|
||||||
|
|
||||||
pg_index_rel = heap_openr(IndexRelationName);
|
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);
|
tupDesc = RelationGetTupleDescriptor(pg_index_rel);
|
||||||
|
|
||||||
*n_indices = 0;
|
*n_indices = 0;
|
||||||
@ -1198,7 +1198,7 @@ CountTuples(Relation relation)
|
|||||||
|
|
||||||
int i;
|
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;
|
for (tuple = heap_getnext(scandesc, 0, NULL), i = 0;
|
||||||
tuple != NULL;
|
tuple != NULL;
|
||||||
|
@ -189,7 +189,7 @@ DropProceduralLanguage(DropPLangStmt * stmt)
|
|||||||
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_language_lanname,
|
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_language_lanname,
|
||||||
F_NAMEEQ, PointerGetDatum(languageName));
|
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);
|
tup = heap_getnext(scanDesc, 0, (Buffer *) NULL);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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:
|
* Note:
|
||||||
* XXX There are many instances of int32 instead of ...Time. These
|
* XXX There are many instances of int32 instead of ...Time. These
|
||||||
@ -110,7 +110,7 @@ RelationPurge(char *relationName,
|
|||||||
key[0].sk_argument = PointerGetDatum(relationName);
|
key[0].sk_argument = PointerGetDatum(relationName);
|
||||||
fmgr_info(key[0].sk_procedure, &key[0].sk_func, &key[0].sk_nargs);
|
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);
|
oldTuple = heap_getnext(scan, 0, &buffer);
|
||||||
if (!HeapTupleIsValid(oldTuple))
|
if (!HeapTupleIsValid(oldTuple))
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -804,8 +804,7 @@ tg_parseTeeNode(TgRecipe * r,
|
|||||||
tt,
|
tt,
|
||||||
tt,
|
tt,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE,
|
FALSE));
|
||||||
NULL));
|
|
||||||
rt_ind = length(orig->rtable);
|
rt_ind = length(orig->rtable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -95,7 +95,7 @@ RemoveOperator(char *operatorName, /* operator name */
|
|||||||
ObjectIdGetDatum(typeId2));
|
ObjectIdGetDatum(typeId2));
|
||||||
|
|
||||||
relation = heap_openr(OperatorRelationName);
|
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);
|
tup = heap_getnext(scan, 0, &buffer);
|
||||||
if (HeapTupleIsValid(tup))
|
if (HeapTupleIsValid(tup))
|
||||||
{
|
{
|
||||||
@ -163,7 +163,7 @@ SingleOpOperatorRemove(Oid typeOid)
|
|||||||
for (i = 0; i < 3; ++i)
|
for (i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
key[0].sk_attno = attnums[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)))
|
while (PointerIsValid(tup = heap_getnext(sdesc, 0, &buffer)))
|
||||||
{
|
{
|
||||||
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
|
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
|
||||||
@ -212,7 +212,7 @@ AttributeAndRelationRemove(Oid typeOid)
|
|||||||
oidptr->next = NULL;
|
oidptr->next = NULL;
|
||||||
optr = oidptr;
|
optr = oidptr;
|
||||||
rdesc = heap_openr(AttributeRelationName);
|
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)))
|
while (PointerIsValid(tup = heap_getnext(sdesc, 0, &buffer)))
|
||||||
{
|
{
|
||||||
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
|
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
|
||||||
@ -233,7 +233,7 @@ AttributeAndRelationRemove(Oid typeOid)
|
|||||||
while (PointerIsValid((char *) optr->next))
|
while (PointerIsValid((char *) optr->next))
|
||||||
{
|
{
|
||||||
key[0].sk_argument = (Datum) (optr++)->reloid;
|
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);
|
tup = heap_getnext(sdesc, 0, &buffer);
|
||||||
if (PointerIsValid(tup))
|
if (PointerIsValid(tup))
|
||||||
{
|
{
|
||||||
@ -283,7 +283,7 @@ RemoveType(char *typeName) /* type name to be removed */
|
|||||||
|
|
||||||
typeKey[0].sk_argument = PointerGetDatum(typeName);
|
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);
|
tup = heap_getnext(scan, 0, (Buffer *) 0);
|
||||||
if (!HeapTupleIsValid(tup))
|
if (!HeapTupleIsValid(tup))
|
||||||
{
|
{
|
||||||
@ -301,7 +301,7 @@ RemoveType(char *typeName) /* type name to be removed */
|
|||||||
shadow_type = makeArrayTypeName(typeName);
|
shadow_type = makeArrayTypeName(typeName);
|
||||||
typeKey[0].sk_argument = NameGetDatum(shadow_type);
|
typeKey[0].sk_argument = NameGetDatum(shadow_type);
|
||||||
|
|
||||||
scan = heap_beginscan(relation, 0, NowTimeQual,
|
scan = heap_beginscan(relation, 0, false,
|
||||||
1, (ScanKey) typeKey);
|
1, (ScanKey) typeKey);
|
||||||
tup = heap_getnext(scan, 0, (Buffer *) 0);
|
tup = heap_getnext(scan, 0, (Buffer *) 0);
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
|
|||||||
fmgr_info(key[0].sk_procedure, &key[0].sk_func, &key[0].sk_nargs);
|
fmgr_info(key[0].sk_procedure, &key[0].sk_func, &key[0].sk_nargs);
|
||||||
|
|
||||||
relation = heap_openr(ProcedureRelationName);
|
relation = heap_openr(ProcedureRelationName);
|
||||||
scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
|
scan = heap_beginscan(relation, 0, false, 1, key);
|
||||||
|
|
||||||
do
|
do
|
||||||
{ /* hope this is ok because it's indexed */
|
{ /* hope this is ok because it's indexed */
|
||||||
@ -496,7 +496,7 @@ RemoveAggregate(char *aggName, char *aggType)
|
|||||||
ObjectIdGetDatum(basetypeID));
|
ObjectIdGetDatum(basetypeID));
|
||||||
|
|
||||||
relation = heap_openr(AggregateRelationName);
|
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);
|
tup = heap_getnext(scan, 0, (Buffer *) 0);
|
||||||
if (!HeapTupleIsValid(tup))
|
if (!HeapTupleIsValid(tup))
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ CreateTrigger(CreateTrigStmt * stmt)
|
|||||||
RelationSetLockForWrite(tgrel);
|
RelationSetLockForWrite(tgrel);
|
||||||
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
||||||
ObjectIdEqualRegProcedure, rel->rd_id);
|
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))
|
while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
|
||||||
{
|
{
|
||||||
Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
|
Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
|
||||||
@ -279,7 +279,7 @@ DropTrigger(DropTrigStmt * stmt)
|
|||||||
RelationSetLockForWrite(tgrel);
|
RelationSetLockForWrite(tgrel);
|
||||||
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
||||||
ObjectIdEqualRegProcedure, rel->rd_id);
|
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))
|
while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
|
||||||
{
|
{
|
||||||
Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
|
Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
|
||||||
@ -344,7 +344,7 @@ RelationRemoveTriggers(Relation rel)
|
|||||||
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
||||||
ObjectIdEqualRegProcedure, rel->rd_id);
|
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))
|
while (tup = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tup))
|
||||||
heap_delete(tgrel, &tup->t_ctid);
|
heap_delete(tgrel, &tup->t_ctid);
|
||||||
@ -395,7 +395,7 @@ RelationBuildTriggers(Relation relation)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
iptr = &indexRes->heap_iptr;
|
iptr = &indexRes->heap_iptr;
|
||||||
tuple = heap_fetch(tgrel, NowTimeQual, iptr, &buffer);
|
tuple = heap_fetch(tgrel, false, iptr, &buffer);
|
||||||
pfree(indexRes);
|
pfree(indexRes);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
continue;
|
continue;
|
||||||
@ -859,7 +859,7 @@ GetTupleForTrigger(Relation relation, ItemPointer tid, bool before)
|
|||||||
}
|
}
|
||||||
|
|
||||||
HeapTupleSatisfies(lp, relation, b, dp,
|
HeapTupleSatisfies(lp, relation, b, dp,
|
||||||
NowTimeQual, 0, (ScanKey) NULL, tuple);
|
false, 0, (ScanKey) NULL, tuple);
|
||||||
if (!tuple)
|
if (!tuple)
|
||||||
{
|
{
|
||||||
ReleaseBuffer(b);
|
ReleaseBuffer(b);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -296,7 +296,7 @@ vc_getrels(NameData *VacRelP)
|
|||||||
pgclass = heap_openr(RelationRelationName);
|
pgclass = heap_openr(RelationRelationName);
|
||||||
pgcdesc = RelationGetTupleDescriptor(pgclass);
|
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)))
|
while (HeapTupleIsValid(pgctup = heap_getnext(pgcscan, 0, &buf)))
|
||||||
{
|
{
|
||||||
@ -429,7 +429,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
|||||||
|
|
||||||
pgclass = heap_openr(RelationRelationName);
|
pgclass = heap_openr(RelationRelationName);
|
||||||
pgcdesc = RelationGetTupleDescriptor(pgclass);
|
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
|
* Race condition -- if the pg_class tuple has gone away since the
|
||||||
@ -1856,7 +1856,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
|
|||||||
ObjectIdGetDatum(relid));
|
ObjectIdGetDatum(relid));
|
||||||
|
|
||||||
rd = heap_openr(RelationRelationName);
|
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)))
|
if (!HeapTupleIsValid(rtup = heap_getnext(rsdesc, 0, &rbuf)))
|
||||||
elog(WARN, "pg_class entry for relid %d vanished during vacuuming",
|
elog(WARN, "pg_class entry for relid %d vanished during vacuuming",
|
||||||
@ -1879,7 +1879,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
|
|||||||
ScanKeyEntryInitialize(&askey, 0, Anum_pg_attribute_attrelid,
|
ScanKeyEntryInitialize(&askey, 0, Anum_pg_attribute_attrelid,
|
||||||
F_INT4EQ, relid);
|
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)))
|
while (HeapTupleIsValid(atup = heap_getnext(asdesc, 0, &abuf)))
|
||||||
{
|
{
|
||||||
@ -2027,10 +2027,10 @@ vc_delhilowstats(Oid relid, int attcnt, int *attnums)
|
|||||||
ScanKeyEntryInitialize(&pgskey, 0x0, Anum_pg_statistic_starelid,
|
ScanKeyEntryInitialize(&pgskey, 0x0, Anum_pg_statistic_starelid,
|
||||||
ObjectIdEqualRegProcedure,
|
ObjectIdEqualRegProcedure,
|
||||||
ObjectIdGetDatum(relid));
|
ObjectIdGetDatum(relid));
|
||||||
pgsscan = heap_beginscan(pgstatistic, false, NowTimeQual, 1, &pgskey);
|
pgsscan = heap_beginscan(pgstatistic, false, false, 1, &pgskey);
|
||||||
}
|
}
|
||||||
else
|
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)))
|
while (HeapTupleIsValid(pgstup = heap_getnext(pgsscan, 0, NULL)))
|
||||||
{
|
{
|
||||||
@ -2284,7 +2284,7 @@ vc_getindices(Oid relid, int *nindices, Relation **Irel)
|
|||||||
ObjectIdEqualRegProcedure,
|
ObjectIdEqualRegProcedure,
|
||||||
ObjectIdGetDatum(relid));
|
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)))
|
while (HeapTupleIsValid(pgitup = heap_getnext(pgiscan, 0, NULL)))
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -236,10 +236,10 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
|
|||||||
*/
|
*/
|
||||||
rt_entry1 =
|
rt_entry1 =
|
||||||
addRangeTableEntry(NULL, (char *) viewName, "*CURRENT*",
|
addRangeTableEntry(NULL, (char *) viewName, "*CURRENT*",
|
||||||
FALSE, FALSE, NULL);
|
FALSE, FALSE);
|
||||||
rt_entry2 =
|
rt_entry2 =
|
||||||
addRangeTableEntry(NULL, (char *) viewName, "*NEW*",
|
addRangeTableEntry(NULL, (char *) viewName, "*NEW*",
|
||||||
FALSE, FALSE, NULL);
|
FALSE, FALSE);
|
||||||
new_rt = lcons(rt_entry2, old_rt);
|
new_rt = lcons(rt_entry2, old_rt);
|
||||||
new_rt = lcons(rt_entry1, new_rt);
|
new_rt = lcons(rt_entry1, new_rt);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
static Pointer
|
static Pointer
|
||||||
ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
|
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);
|
static Relation ExecOpenR(Oid relationOid, bool isindex);
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
@ -70,7 +70,6 @@ ExecOpenScanR(Oid relOid,
|
|||||||
ScanKey skeys,
|
ScanKey skeys,
|
||||||
bool isindex,
|
bool isindex,
|
||||||
ScanDirection dir,
|
ScanDirection dir,
|
||||||
TimeQual timeRange,
|
|
||||||
Relation *returnRelation, /* return */
|
Relation *returnRelation, /* return */
|
||||||
Pointer *returnScanDesc) /* return */
|
Pointer *returnScanDesc) /* return */
|
||||||
{
|
{
|
||||||
@ -89,8 +88,7 @@ ExecOpenScanR(Oid relOid,
|
|||||||
nkeys,
|
nkeys,
|
||||||
skeys,
|
skeys,
|
||||||
isindex,
|
isindex,
|
||||||
dir,
|
dir);
|
||||||
timeRange);
|
|
||||||
|
|
||||||
if (returnRelation != NULL)
|
if (returnRelation != NULL)
|
||||||
*returnRelation = relation;
|
*returnRelation = relation;
|
||||||
@ -146,8 +144,7 @@ ExecBeginScan(Relation relation,
|
|||||||
int nkeys,
|
int nkeys,
|
||||||
ScanKey skeys,
|
ScanKey skeys,
|
||||||
bool isindex,
|
bool isindex,
|
||||||
ScanDirection dir,
|
ScanDirection dir)
|
||||||
TimeQual time_range)
|
|
||||||
{
|
{
|
||||||
Pointer scanDesc;
|
Pointer scanDesc;
|
||||||
|
|
||||||
@ -172,7 +169,7 @@ ExecBeginScan(Relation relation,
|
|||||||
{
|
{
|
||||||
scanDesc = (Pointer) heap_beginscan(relation,
|
scanDesc = (Pointer) heap_beginscan(relation,
|
||||||
ScanDirectionIsBackward(dir),
|
ScanDirectionIsBackward(dir),
|
||||||
time_range,
|
false,
|
||||||
nkeys,
|
nkeys,
|
||||||
skeys);
|
skeys);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1331,13 +1331,11 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
|
|||||||
slot->ttc_buffer = InvalidBuffer;
|
slot->ttc_buffer = InvalidBuffer;
|
||||||
slot->ttc_whichplan = -1;
|
slot->ttc_whichplan = -1;
|
||||||
rte->relname = nameout(&(rel->rd_rel->relname));
|
rte->relname = nameout(&(rel->rd_rel->relname));
|
||||||
rte->timeRange = NULL;
|
|
||||||
rte->refname = rte->relname;
|
rte->refname = rte->relname;
|
||||||
rte->relid = rel->rd_id;
|
rte->relid = rel->rd_id;
|
||||||
rte->inh = false;
|
rte->inh = false;
|
||||||
rte->archive = false;
|
rte->archive = false;
|
||||||
rte->inFromCl = true;
|
rte->inFromCl = true;
|
||||||
rte->timeQual = NULL;
|
|
||||||
rtlist = lcons(rte, NIL);
|
rtlist = lcons(rte, NIL);
|
||||||
econtext->ecxt_scantuple = slot; /* scan tuple slot */
|
econtext->ecxt_scantuple = slot; /* scan tuple slot */
|
||||||
econtext->ecxt_innertuple = NULL; /* inner tuple slot */
|
econtext->ecxt_innertuple = NULL; /* inner tuple slot */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -756,7 +756,7 @@ ExecOpenIndices(Oid resultRelationOid,
|
|||||||
*/
|
*/
|
||||||
indexSd = heap_beginscan(indexRd, /* scan desc */
|
indexSd = heap_beginscan(indexRd, /* scan desc */
|
||||||
false, /* scan backward flag */
|
false, /* scan backward flag */
|
||||||
NowTimeQual, /* time qual */
|
false, /* see self */
|
||||||
1, /* number scan keys */
|
1, /* number scan keys */
|
||||||
&key); /* scan keys */
|
&key); /* scan keys */
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -128,7 +128,7 @@ IndexNext(IndexScan *node)
|
|||||||
{
|
{
|
||||||
iptr = &result->heap_iptr;
|
iptr = &result->heap_iptr;
|
||||||
tuple = heap_fetch(heapRelation,
|
tuple = heap_fetch(heapRelation,
|
||||||
NowTimeQual,
|
false,
|
||||||
iptr,
|
iptr,
|
||||||
&buffer);
|
&buffer);
|
||||||
/* be tidy */
|
/* be tidy */
|
||||||
@ -480,7 +480,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
|||||||
RangeTblEntry *rtentry;
|
RangeTblEntry *rtentry;
|
||||||
Index relid;
|
Index relid;
|
||||||
Oid reloid;
|
Oid reloid;
|
||||||
TimeQual timeQual;
|
|
||||||
|
|
||||||
Relation currentRelation;
|
Relation currentRelation;
|
||||||
HeapScanDesc currentScanDesc;
|
HeapScanDesc currentScanDesc;
|
||||||
@ -911,14 +910,12 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
|||||||
relid = node->scan.scanrelid;
|
relid = node->scan.scanrelid;
|
||||||
rtentry = rt_fetch(relid, rangeTable);
|
rtentry = rt_fetch(relid, rangeTable);
|
||||||
reloid = rtentry->relid;
|
reloid = rtentry->relid;
|
||||||
timeQual = rtentry->timeQual;
|
|
||||||
|
|
||||||
ExecOpenScanR(reloid, /* relation */
|
ExecOpenScanR(reloid, /* relation */
|
||||||
0, /* nkeys */
|
0, /* nkeys */
|
||||||
(ScanKey) NULL, /* scan key */
|
(ScanKey) NULL, /* scan key */
|
||||||
0, /* is index */
|
0, /* is index */
|
||||||
direction, /* scan direction */
|
direction, /* scan direction */
|
||||||
timeQual, /* time qual */
|
|
||||||
¤tRelation, /* return: rel desc */
|
¤tRelation, /* return: rel desc */
|
||||||
(Pointer *) ¤tScanDesc); /* return: scan desc */
|
(Pointer *) ¤tScanDesc); /* return: scan desc */
|
||||||
|
|
||||||
@ -957,7 +954,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
|||||||
scanKeys[i], /* scan key */
|
scanKeys[i], /* scan key */
|
||||||
true, /* is index */
|
true, /* is index */
|
||||||
direction, /* scan direction */
|
direction, /* scan direction */
|
||||||
timeQual, /* time qual */
|
|
||||||
&(relationDescs[i]), /* return: rel desc */
|
&(relationDescs[i]), /* return: rel desc */
|
||||||
(Pointer *) &(scanDescs[i]));
|
(Pointer *) &(scanDescs[i]));
|
||||||
/* return: scan desc */
|
/* return: scan desc */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -140,7 +140,7 @@ ExecMaterial(Material *node)
|
|||||||
currentScanDesc = heap_beginscan(currentRelation, /* relation */
|
currentScanDesc = heap_beginscan(currentRelation, /* relation */
|
||||||
ScanDirectionIsBackward(dir),
|
ScanDirectionIsBackward(dir),
|
||||||
/* bkwd flag */
|
/* bkwd flag */
|
||||||
NowTimeQual, /* time qual */
|
false, /* seeself */
|
||||||
0, /* num scan keys */
|
0, /* num scan keys */
|
||||||
NULL); /* scan keys */
|
NULL); /* scan keys */
|
||||||
matstate->csstate.css_currentRelation = currentRelation;
|
matstate->csstate.css_currentRelation = currentRelation;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -158,7 +158,6 @@ InitScanRelation(SeqScan *node, EState *estate,
|
|||||||
List *rangeTable;
|
List *rangeTable;
|
||||||
RangeTblEntry *rtentry;
|
RangeTblEntry *rtentry;
|
||||||
Oid reloid;
|
Oid reloid;
|
||||||
TimeQual timeQual;
|
|
||||||
ScanDirection direction;
|
ScanDirection direction;
|
||||||
Relation currentRelation;
|
Relation currentRelation;
|
||||||
HeapScanDesc currentScanDesc;
|
HeapScanDesc currentScanDesc;
|
||||||
@ -179,7 +178,6 @@ InitScanRelation(SeqScan *node, EState *estate,
|
|||||||
rangeTable = estate->es_range_table;
|
rangeTable = estate->es_range_table;
|
||||||
rtentry = rt_fetch(relid, rangeTable);
|
rtentry = rt_fetch(relid, rangeTable);
|
||||||
reloid = rtentry->relid;
|
reloid = rtentry->relid;
|
||||||
timeQual = rtentry->timeQual;
|
|
||||||
direction = estate->es_direction;
|
direction = estate->es_direction;
|
||||||
resultRelationInfo = estate->es_result_relation_info;
|
resultRelationInfo = estate->es_result_relation_info;
|
||||||
|
|
||||||
@ -188,7 +186,6 @@ InitScanRelation(SeqScan *node, EState *estate,
|
|||||||
NULL, /* scan key */
|
NULL, /* scan key */
|
||||||
0, /* is index */
|
0, /* is index */
|
||||||
direction,/* scan direction */
|
direction,/* scan direction */
|
||||||
timeQual, /* time qual */
|
|
||||||
¤tRelation, /* return: rel desc */
|
¤tRelation, /* return: rel desc */
|
||||||
(Pointer *) ¤tScanDesc); /* return: scan desc */
|
(Pointer *) ¤tScanDesc); /* return: scan desc */
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ExecEndTee
|
* ExecEndTee
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -252,7 +252,7 @@ initTeeScanDescs(Tee *node)
|
|||||||
{
|
{
|
||||||
teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
|
teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
|
||||||
ScanDirectionIsBackward(dir),
|
ScanDirectionIsBackward(dir),
|
||||||
NowTimeQual, /* time qual */
|
false, /* seeself */
|
||||||
0, /* num scan keys */
|
0, /* num scan keys */
|
||||||
NULL /* scan keys */
|
NULL /* scan keys */
|
||||||
);
|
);
|
||||||
@ -261,7 +261,7 @@ initTeeScanDescs(Tee *node)
|
|||||||
{
|
{
|
||||||
teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
|
teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
|
||||||
ScanDirectionIsBackward(dir),
|
ScanDirectionIsBackward(dir),
|
||||||
NowTimeQual, /* time qual */
|
false, /* seeself */
|
||||||
0, /* num scan keys */
|
0, /* num scan keys */
|
||||||
NULL /* scan keys */
|
NULL /* scan keys */
|
||||||
);
|
);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1470,8 +1470,6 @@ _copyRangeTblEntry(RangeTblEntry *from)
|
|||||||
newnode->relname = pstrdup(from->relname);
|
newnode->relname = pstrdup(from->relname);
|
||||||
if (from->refname)
|
if (from->refname)
|
||||||
newnode->refname = pstrdup(from->refname);
|
newnode->refname = pstrdup(from->refname);
|
||||||
newnode->timeRange = NULL;
|
|
||||||
newnode->timeQual = NULL;
|
|
||||||
|
|
||||||
return newnode;
|
return newnode;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -998,7 +998,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
|
|||||||
* will be used to find the associated strategy numbers for the test.
|
* will be used to find the associated strategy numbers for the test.
|
||||||
* --Nels, Jan '93
|
* --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);
|
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
{
|
{
|
||||||
@ -1029,7 +1029,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
|
|||||||
ObjectIdEqualRegProcedure,
|
ObjectIdEqualRegProcedure,
|
||||||
ObjectIdGetDatum(clause_op));
|
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);
|
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
{
|
{
|
||||||
@ -1061,7 +1061,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
|
|||||||
Integer16EqualRegProcedure,
|
Integer16EqualRegProcedure,
|
||||||
Int16GetDatum(test_strategy));
|
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);
|
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
{
|
{
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* 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));
|
|
||||||
}
|
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -178,10 +178,6 @@ plan_union_queries(Index rt_index,
|
|||||||
union_relids = VersionGetParents(rt_entry->relid);
|
union_relids = VersionGetParents(rt_entry->relid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ARCHIVE_FLAG:
|
|
||||||
union_relids = find_archive_rels(rt_entry->relid);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
break;
|
break;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -148,7 +148,7 @@ index_info(Query *root, bool first, int relid, IdxInfoRetval *info)
|
|||||||
ObjectIdGetDatum(indrelid));
|
ObjectIdGetDatum(indrelid));
|
||||||
|
|
||||||
relation = heap_openr(IndexRelationName);
|
relation = heap_openr(IndexRelationName);
|
||||||
scan = heap_beginscan(relation, 0, NowTimeQual,
|
scan = heap_beginscan(relation, 0, false,
|
||||||
1, &indexKey);
|
1, &indexKey);
|
||||||
}
|
}
|
||||||
if (!HeapScanIsValid(scan))
|
if (!HeapScanIsValid(scan))
|
||||||
@ -420,7 +420,7 @@ find_inheritance_children(Oid inhparent)
|
|||||||
|
|
||||||
key[0].sk_argument = ObjectIdGetDatum((Oid) inhparent);
|
key[0].sk_argument = ObjectIdGetDatum((Oid) inhparent);
|
||||||
relation = heap_openr(InheritsRelationName);
|
relation = heap_openr(InheritsRelationName);
|
||||||
scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
|
scan = heap_beginscan(relation, 0, false, 1, key);
|
||||||
while (HeapTupleIsValid(inheritsTuple =
|
while (HeapTupleIsValid(inheritsTuple =
|
||||||
heap_getnext(scan, 0,
|
heap_getnext(scan, 0,
|
||||||
(Buffer *) NULL)))
|
(Buffer *) NULL)))
|
||||||
@ -455,7 +455,7 @@ VersionGetParents(Oid verrelid)
|
|||||||
fmgr_info(F_OIDEQ, &key[0].sk_func, &key[0].sk_nargs);
|
fmgr_info(F_OIDEQ, &key[0].sk_func, &key[0].sk_nargs);
|
||||||
relation = heap_openr(VersionRelationName);
|
relation = heap_openr(VersionRelationName);
|
||||||
key[0].sk_argument = ObjectIdGetDatum(verrelid);
|
key[0].sk_argument = ObjectIdGetDatum(verrelid);
|
||||||
scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
|
scan = heap_beginscan(relation, 0, false, 1, key);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
versionTuple = heap_getnext(scan, 0,
|
versionTuple = heap_getnext(scan, 0,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# Makefile for parser
|
# Makefile for parser
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# 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 $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
OBJS= analyze.o catalog_utils.o dbcommands.o gram.o \
|
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
|
all: SUBSYS.o
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#include "nodes/parsenodes.h"
|
#include "nodes/parsenodes.h"
|
||||||
#include "nodes/relation.h"
|
#include "nodes/relation.h"
|
||||||
#include "parse.h" /* for AND, OR, etc. */
|
#include "parse.h" /* for AND, OR, etc. */
|
||||||
|
#include "catalog/pg_aggregate.h"
|
||||||
#include "catalog/pg_type.h" /* for INT4OID, etc. */
|
#include "catalog/pg_type.h" /* for INT4OID, etc. */
|
||||||
#include "catalog/pg_proc.h"
|
#include "catalog/pg_proc.h"
|
||||||
#include "utils/elog.h"
|
#include "utils/elog.h"
|
||||||
@ -66,33 +67,31 @@ static List *expandAllTables(ParseState *pstate);
|
|||||||
static char *figureColname(Node *expr, Node *resval);
|
static char *figureColname(Node *expr, Node *resval);
|
||||||
static List *makeTargetNames(ParseState *pstate, List *cols);
|
static List *makeTargetNames(ParseState *pstate, List *cols);
|
||||||
static List *transformTargetList(ParseState *pstate, List *targetlist);
|
static List *transformTargetList(ParseState *pstate, List *targetlist);
|
||||||
static TargetEntry *
|
static TargetEntry *make_targetlist_expr(ParseState *pstate,
|
||||||
make_targetlist_expr(ParseState *pstate,
|
|
||||||
char *colname, Node *expr,
|
char *colname, Node *expr,
|
||||||
List *arrayRef);
|
List *arrayRef);
|
||||||
static bool inWhereClause = false;
|
static bool inWhereClause = false;
|
||||||
static Node *transformWhereClause(ParseState *pstate, Node *a_expr);
|
static Node *transformWhereClause(ParseState *pstate, Node *a_expr);
|
||||||
static List *
|
static List *transformGroupClause(ParseState *pstate, List *grouplist,
|
||||||
transformGroupClause(ParseState *pstate, List *grouplist,
|
|
||||||
List *targetlist);
|
List *targetlist);
|
||||||
static List *
|
static List *transformSortClause(ParseState *pstate,
|
||||||
transformSortClause(ParseState *pstate,
|
|
||||||
List *orderlist, List *targetlist,
|
List *orderlist, List *targetlist,
|
||||||
char *uniqueFlag);
|
char *uniqueFlag);
|
||||||
|
|
||||||
static void parseFromClause(ParseState *pstate, List *frmList);
|
static void parseFromClause(ParseState *pstate, List *frmList);
|
||||||
static Node *
|
static Node *ParseFunc(ParseState *pstate, char *funcname,
|
||||||
ParseFunc(ParseState *pstate, char *funcname,
|
|
||||||
List *fargs, int *curr_resno);
|
List *fargs, int *curr_resno);
|
||||||
static List *setup_tlist(char *attname, Oid relid);
|
static List *setup_tlist(char *attname, Oid relid);
|
||||||
static List *setup_base_tlist(Oid typeid);
|
static List *setup_base_tlist(Oid typeid);
|
||||||
static void
|
static void make_arguments(int nargs, List *fargs, Oid *input_typeids,
|
||||||
make_arguments(int nargs, List *fargs, Oid *input_typeids,
|
|
||||||
Oid *function_typeids);
|
Oid *function_typeids);
|
||||||
static void AddAggToParseState(ParseState *pstate, Aggreg *aggreg);
|
static void AddAggToParseState(ParseState *pstate, Aggreg *aggreg);
|
||||||
static void finalizeAggregates(ParseState *pstate, Query *qry);
|
static void finalizeAggregates(ParseState *pstate, Query *qry);
|
||||||
static void parseCheckAggregates(ParseState *pstate, Query *qry);
|
static void parseCheckAggregates(ParseState *pstate, Query *qry);
|
||||||
static ParseState *makeParseState(void);
|
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);
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
@ -464,9 +463,9 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
|
|||||||
* equal to 2.
|
* equal to 2.
|
||||||
*/
|
*/
|
||||||
addRangeTableEntry(pstate, stmt->object->relname, "*CURRENT*",
|
addRangeTableEntry(pstate, stmt->object->relname, "*CURRENT*",
|
||||||
FALSE, FALSE, NULL);
|
FALSE, FALSE);
|
||||||
addRangeTableEntry(pstate, stmt->object->relname, "*NEW*",
|
addRangeTableEntry(pstate, stmt->object->relname, "*NEW*",
|
||||||
FALSE, FALSE, NULL);
|
FALSE, FALSE);
|
||||||
|
|
||||||
pstate->p_last_resno = 1;
|
pstate->p_last_resno = 1;
|
||||||
pstate->p_is_rule = true; /* for expand all */
|
pstate->p_is_rule = true; /* for expand all */
|
||||||
@ -947,8 +946,7 @@ parseFromClause(ParseState *pstate, List *frmList)
|
|||||||
* eg. select * from foo f where f.x = 1; will generate wrong answer
|
* eg. select * from foo f where f.x = 1; will generate wrong answer
|
||||||
* if we expand * to foo.x.
|
* if we expand * to foo.x.
|
||||||
*/
|
*/
|
||||||
rte = addRangeTableEntry(pstate, relname, refname, baserel->inh, TRUE,
|
rte = addRangeTableEntry(pstate, relname, refname, baserel->inh, TRUE);
|
||||||
baserel->timeRange);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,7 +966,7 @@ makeRangeTable(ParseState *pstate, char *relname, List *frmList)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (refnameRangeTablePosn(pstate->p_rtable, relname) < 1)
|
if (refnameRangeTablePosn(pstate->p_rtable, relname) < 1)
|
||||||
rte = addRangeTableEntry(pstate, relname, relname, FALSE, FALSE, NULL);
|
rte = addRangeTableEntry(pstate, relname, relname, FALSE, FALSE);
|
||||||
else
|
else
|
||||||
rte = refnameRangeTableEntry(pstate->p_rtable, relname);
|
rte = refnameRangeTableEntry(pstate->p_rtable, relname);
|
||||||
|
|
||||||
@ -2321,7 +2319,7 @@ ParseFunc(ParseState *pstate, char *funcname, List *fargs, int *curr_resno)
|
|||||||
|
|
||||||
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
|
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
|
||||||
if (rte == NULL)
|
if (rte == NULL)
|
||||||
rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE, NULL);
|
rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE);
|
||||||
|
|
||||||
relname = rte->relname;
|
relname = rte->relname;
|
||||||
relid = rte->relid;
|
relid = rte->relid;
|
||||||
@ -2443,7 +2441,7 @@ ParseFunc(ParseState *pstate, char *funcname, List *fargs, int *curr_resno)
|
|||||||
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
|
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
|
||||||
if (rte == NULL)
|
if (rte == NULL)
|
||||||
rte = addRangeTableEntry(pstate, refname, refname,
|
rte = addRangeTableEntry(pstate, refname, refname,
|
||||||
FALSE, FALSE, NULL);
|
FALSE, FALSE);
|
||||||
relname = rte->relname;
|
relname = rte->relname;
|
||||||
|
|
||||||
vnum = refnameRangeTablePosn(pstate->p_rtable, rte->refname);
|
vnum = refnameRangeTablePosn(pstate->p_rtable, rte->refname);
|
||||||
@ -2862,3 +2860,340 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
|
|||||||
*/
|
*/
|
||||||
return;
|
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;
|
||||||
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -347,7 +347,7 @@ binary_oper_get_candidates(char *opname,
|
|||||||
pg_operator_desc = heap_openr(OperatorRelationName);
|
pg_operator_desc = heap_openr(OperatorRelationName);
|
||||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
nkeys,
|
nkeys,
|
||||||
opKey);
|
opKey);
|
||||||
|
|
||||||
@ -642,7 +642,7 @@ unary_oper_get_candidates(char *op,
|
|||||||
pg_operator_desc = heap_openr(OperatorRelationName);
|
pg_operator_desc = heap_openr(OperatorRelationName);
|
||||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
2,
|
2,
|
||||||
opKey);
|
opKey);
|
||||||
|
|
||||||
@ -1004,7 +1004,7 @@ func_get_candidates(char *funcname, int nargs)
|
|||||||
ItemPointer iptr;
|
ItemPointer iptr;
|
||||||
|
|
||||||
iptr = &indexRes->heap_iptr;
|
iptr = &indexRes->heap_iptr;
|
||||||
tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
|
tuple = heap_fetch(heapRelation, false, iptr, &buffer);
|
||||||
pfree(indexRes);
|
pfree(indexRes);
|
||||||
if (HeapTupleIsValid(tuple))
|
if (HeapTupleIsValid(tuple))
|
||||||
{
|
{
|
||||||
@ -1352,7 +1352,7 @@ findsupers(Oid relid, Oid **supervec)
|
|||||||
ObjectIdEqualRegProcedure,
|
ObjectIdEqualRegProcedure,
|
||||||
ObjectIdGetDatum(relid));
|
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)))
|
while (HeapTupleIsValid(inhtup = heap_getnext(inhscan, 0, &buf)))
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -159,7 +159,7 @@ get_pg_dbtup(char *command, char *dbname, Relation dbrel)
|
|||||||
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
|
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
|
||||||
NameEqualRegProcedure, NameGetDatum(dbname));
|
NameEqualRegProcedure, NameGetDatum(dbname));
|
||||||
|
|
||||||
scan = heap_beginscan(dbrel, 0, NowTimeQual, 1, &scanKey);
|
scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
|
||||||
if (!HeapScanIsValid(scan))
|
if (!HeapScanIsValid(scan))
|
||||||
elog(WARN, "%s: cannot begin scan of pg_database.", command);
|
elog(WARN, "%s: cannot begin scan of pg_database.", command);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -95,7 +95,6 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
|
|||||||
IndexElem *ielem;
|
IndexElem *ielem;
|
||||||
RangeVar *range;
|
RangeVar *range;
|
||||||
RelExpr *relexp;
|
RelExpr *relexp;
|
||||||
TimeRange *trange;
|
|
||||||
A_Indices *aind;
|
A_Indices *aind;
|
||||||
ResTarget *target;
|
ResTarget *target;
|
||||||
ParamNo *paramno;
|
ParamNo *paramno;
|
||||||
@ -134,8 +133,7 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
|
|||||||
|
|
||||||
%type <str> opt_id, opt_portal_name,
|
%type <str> opt_id, opt_portal_name,
|
||||||
before_clause, after_clause, all_Op, MathOp, opt_name, opt_unique,
|
before_clause, after_clause, all_Op, MathOp, opt_name, opt_unique,
|
||||||
result, OptUseOp, opt_class, opt_range_start, opt_range_end,
|
result, OptUseOp, opt_class, SpecialRuleRelation
|
||||||
SpecialRuleRelation
|
|
||||||
|
|
||||||
%type <str> privileges, operation_commalist, grantee
|
%type <str> privileges, operation_commalist, grantee
|
||||||
%type <chr> operation, TriggerOneEvent
|
%type <chr> operation, TriggerOneEvent
|
||||||
@ -190,7 +188,6 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
|
|||||||
%type <ielem> index_elem, func_index
|
%type <ielem> index_elem, func_index
|
||||||
%type <range> from_val
|
%type <range> from_val
|
||||||
%type <relexp> relation_expr
|
%type <relexp> relation_expr
|
||||||
%type <trange> time_range
|
|
||||||
%type <target> res_target_el, res_target_el2
|
%type <target> res_target_el, res_target_el2
|
||||||
%type <paramno> ParamNo
|
%type <paramno> ParamNo
|
||||||
|
|
||||||
@ -2353,7 +2350,6 @@ relation_expr: relation_name
|
|||||||
$$ = makeNode(RelExpr);
|
$$ = makeNode(RelExpr);
|
||||||
$$->relname = $1;
|
$$->relname = $1;
|
||||||
$$->inh = FALSE;
|
$$->inh = FALSE;
|
||||||
$$->timeRange = NULL;
|
|
||||||
}
|
}
|
||||||
| relation_name '*' %prec '='
|
| relation_name '*' %prec '='
|
||||||
{
|
{
|
||||||
@ -2361,44 +2357,7 @@ relation_expr: relation_name
|
|||||||
$$ = makeNode(RelExpr);
|
$$ = makeNode(RelExpr);
|
||||||
$$->relname = $1;
|
$$->relname = $1;
|
||||||
$$->inh = TRUE;
|
$$->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
|
opt_array_bounds: '[' ']' nest_array_bounds
|
||||||
{ $$ = lcons(makeInteger(-1), $3); }
|
{ $$ = lcons(makeInteger(-1), $3); }
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -127,8 +127,8 @@ RangeTblEntry *
|
|||||||
addRangeTableEntry(ParseState *pstate,
|
addRangeTableEntry(ParseState *pstate,
|
||||||
char *relname,
|
char *relname,
|
||||||
char *refname,
|
char *refname,
|
||||||
bool inh, bool inFromCl,
|
bool inh,
|
||||||
TimeRange *timeRange)
|
bool inFromCl)
|
||||||
{
|
{
|
||||||
Relation relation;
|
Relation relation;
|
||||||
RangeTblEntry *rte = makeNode(RangeTblEntry);
|
RangeTblEntry *rte = makeNode(RangeTblEntry);
|
||||||
@ -154,8 +154,6 @@ addRangeTableEntry(ParseState *pstate,
|
|||||||
*/
|
*/
|
||||||
rte->inh = inh;
|
rte->inh = inh;
|
||||||
|
|
||||||
rte->timeRange = timeRange;
|
|
||||||
|
|
||||||
/* RelOID */
|
/* RelOID */
|
||||||
rte->relid = RelationGetRelationId(relation);
|
rte->relid = RelationGetRelationId(relation);
|
||||||
|
|
||||||
@ -194,7 +192,7 @@ expandAll(ParseState *pstate, char *relname, char *refname, int *this_resno)
|
|||||||
|
|
||||||
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
|
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
|
||||||
if (rte == NULL)
|
if (rte == NULL)
|
||||||
rte = addRangeTableEntry(pstate, relname, refname, FALSE, FALSE, NULL);
|
rte = addRangeTableEntry(pstate, relname, refname, FALSE, FALSE);
|
||||||
|
|
||||||
rdesc = heap_open(rte->relid);
|
rdesc = heap_open(rte->relid);
|
||||||
|
|
||||||
@ -475,7 +473,7 @@ make_var(ParseState *pstate, char *refname, char *attrname, Oid *type_id)
|
|||||||
|
|
||||||
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
|
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
|
||||||
if (rte == NULL)
|
if (rte == NULL)
|
||||||
rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE, NULL);
|
rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE);
|
||||||
|
|
||||||
vnum = refnameRangeTablePosn(pstate->p_rtable, refname);
|
vnum = refnameRangeTablePosn(pstate->p_rtable, refname);
|
||||||
|
|
||||||
|
@ -6,45 +6,20 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <pwd.h>
|
|
||||||
#include <sys/param.h> /* for MAXPATHLEN */
|
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#include "parser/catalog_utils.h"
|
|
||||||
#include "parser/gramparse.h"
|
#include "parser/gramparse.h"
|
||||||
#include "parser/parse_query.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/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
|
char *parseString; /* the char* which holds the string to be
|
||||||
* parsed */
|
* parsed */
|
||||||
char *parseCh; /* a pointer used during parsing to walk
|
|
||||||
* down ParseString */
|
|
||||||
|
|
||||||
List *parsetree = NIL;
|
List *parsetree = NIL;
|
||||||
|
|
||||||
#ifdef SETS_FIXED
|
#ifdef SETS_FIXED
|
||||||
@ -70,9 +45,7 @@ parser(char *str, Oid *typev, int nargs)
|
|||||||
|
|
||||||
init_io();
|
init_io();
|
||||||
|
|
||||||
/* Set things up to read from the string, if there is one */
|
parseString = pstrdup(str);
|
||||||
parseString = (char *) palloc(strlen(str) + 1);
|
|
||||||
memmove(parseString, str, strlen(str) + 1);
|
|
||||||
|
|
||||||
parser_init(typev, nargs);
|
parser_init(typev, nargs);
|
||||||
yyresult = yyparse();
|
yyresult = yyparse();
|
||||||
@ -83,10 +56,8 @@ parser(char *str, Oid *typev, int nargs)
|
|||||||
|
|
||||||
clearerr(stdin);
|
clearerr(stdin);
|
||||||
|
|
||||||
if (yyresult)
|
if (yyresult) /* error */
|
||||||
{ /* error */
|
|
||||||
return ((QueryTreeList *) NULL);
|
return ((QueryTreeList *) NULL);
|
||||||
}
|
|
||||||
|
|
||||||
queryList = parse_analyze(parsetree);
|
queryList = parse_analyze(parsetree);
|
||||||
|
|
||||||
@ -205,339 +176,3 @@ define_sets(Node *clause)
|
|||||||
|
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -29,12 +29,11 @@
|
|||||||
#include "parser/gramparse.h"
|
#include "parser/gramparse.h"
|
||||||
#include "parser/keywords.h"
|
#include "parser/keywords.h"
|
||||||
#include "parser/scansup.h"
|
#include "parser/scansup.h"
|
||||||
#include "parser/sysfunc.h"
|
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
|
|
||||||
extern char *parseString;
|
extern char *parseString;
|
||||||
extern char *parseCh;
|
static char *parseCh;
|
||||||
|
|
||||||
/* some versions of lex define this as a macro */
|
/* some versions of lex define this as a macro */
|
||||||
#if defined(yywrap)
|
#if defined(yywrap)
|
||||||
@ -127,8 +126,6 @@ number [-+.0-9Ee]
|
|||||||
letter [\200-\377_A-Za-z]
|
letter [\200-\377_A-Za-z]
|
||||||
letter_or_digit [\200-\377_A-Za-z0-9]
|
letter_or_digit [\200-\377_A-Za-z0-9]
|
||||||
|
|
||||||
sysfunc SYS_{letter}{letter_or_digit}*
|
|
||||||
|
|
||||||
identifier {letter}{letter_or_digit}*
|
identifier {letter}{letter_or_digit}*
|
||||||
|
|
||||||
typecast "::"
|
typecast "::"
|
||||||
@ -278,11 +275,6 @@ other .
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{sysfunc} {
|
|
||||||
yylval.str = pstrdup(SystemFunctionHandler((char *)yytext));
|
|
||||||
return (SCONST);
|
|
||||||
}
|
|
||||||
|
|
||||||
{typecast} { return TYPECAST; }
|
{typecast} { return TYPECAST; }
|
||||||
|
|
||||||
{self}/-[\.0-9] {
|
{self}/-[\.0-9] {
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* 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
|
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -90,7 +90,7 @@ RemoveRewriteRule(char *ruleName)
|
|||||||
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_rewrite_rulename,
|
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_rewrite_rulename,
|
||||||
F_CHAR16EQ, NameGetDatum(ruleName));
|
F_CHAR16EQ, NameGetDatum(ruleName));
|
||||||
scanDesc = heap_beginscan(RewriteRelation,
|
scanDesc = heap_beginscan(RewriteRelation,
|
||||||
0, NowTimeQual, 1, &scanKeyData);
|
0, false, 1, &scanKeyData);
|
||||||
|
|
||||||
tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
|
tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ RelationRemoveRules(Oid relid)
|
|||||||
F_OIDEQ,
|
F_OIDEQ,
|
||||||
ObjectIdGetDatum(relid));
|
ObjectIdGetDatum(relid));
|
||||||
scanDesc = heap_beginscan(RewriteRelation,
|
scanDesc = heap_beginscan(RewriteRelation,
|
||||||
0, NowTimeQual, 1, &scanKeyData);
|
0, false, 1, &scanKeyData);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -109,7 +109,7 @@ IsDefinedRewriteRule(char *ruleName)
|
|||||||
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_rewrite_rulename,
|
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_rewrite_rulename,
|
||||||
NameEqualRegProcedure, PointerGetDatum(ruleName));
|
NameEqualRegProcedure, PointerGetDatum(ruleName));
|
||||||
scanDesc = heap_beginscan(RewriteRelation,
|
scanDesc = heap_beginscan(RewriteRelation,
|
||||||
0, NowTimeQual, 1, &scanKey);
|
0, false, 1, &scanKey);
|
||||||
|
|
||||||
tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
|
tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -628,7 +628,7 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP)
|
|||||||
* a time qual in.
|
* a time qual in.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
htup = heap_fetch(obj_desc->heap_r, NowTimeQual,
|
htup = heap_fetch(obj_desc->heap_r, false,
|
||||||
&(res->heap_iptr), bufP);
|
&(res->heap_iptr), bufP);
|
||||||
|
|
||||||
} while (htup == (HeapTuple) NULL);
|
} while (htup == (HeapTuple) NULL);
|
||||||
@ -639,7 +639,7 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
htup = heap_fetch(obj_desc->heap_r, NowTimeQual,
|
htup = heap_fetch(obj_desc->heap_r, false,
|
||||||
&(obj_desc->htid), bufP);
|
&(obj_desc->htid), bufP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1206,7 +1206,7 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln)
|
|||||||
if (buf != InvalidBuffer)
|
if (buf != InvalidBuffer)
|
||||||
ReleaseBuffer(buf);
|
ReleaseBuffer(buf);
|
||||||
|
|
||||||
htup = heap_fetch(hreln, NowTimeQual, &(res->heap_iptr), &buf);
|
htup = heap_fetch(hreln, false, &(res->heap_iptr), &buf);
|
||||||
|
|
||||||
} while (!HeapTupleIsValid(htup));
|
} while (!HeapTupleIsValid(htup));
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* See acl.h.
|
* See acl.h.
|
||||||
@ -123,7 +123,7 @@ ChangeAcl(char *relname,
|
|||||||
relkey[0].sk_argument = NameGetDatum(relname);
|
relkey[0].sk_argument = NameGetDatum(relname);
|
||||||
hsdp = heap_beginscan(relation,
|
hsdp = heap_beginscan(relation,
|
||||||
0,
|
0,
|
||||||
NowTimeQual,
|
false,
|
||||||
(unsigned) 1,
|
(unsigned) 1,
|
||||||
relkey);
|
relkey);
|
||||||
htp = heap_getnext(hsdp, 0, &buffer);
|
htp = heap_getnext(hsdp, 0, &buffer);
|
||||||
@ -491,7 +491,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
|
|||||||
&relkey[0].sk_func,
|
&relkey[0].sk_func,
|
||||||
&relkey[0].sk_nargs);
|
&relkey[0].sk_nargs);
|
||||||
relkey[0].sk_argument = NameGetDatum(relname);
|
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);
|
htp = heap_getnext(hsdp, 0, (Buffer *) 0);
|
||||||
if (HeapTupleIsValid(htp) &&
|
if (HeapTupleIsValid(htp) &&
|
||||||
!heap_attisnull(htp, Anum_pg_class_relacl))
|
!heap_attisnull(htp, Anum_pg_class_relacl))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -72,7 +72,7 @@ int4notin(int16 not_in_arg, char *relation_and_attr)
|
|||||||
/* the last argument should be a ScanKey, not an integer! - jolly */
|
/* the last argument should be a ScanKey, not an integer! - jolly */
|
||||||
/* it looks like the arguments are out of order, too */
|
/* it looks like the arguments are out of order, too */
|
||||||
/* but skeyData is never initialized! does this work?? - ay 2/95 */
|
/* 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);
|
&skeyData);
|
||||||
|
|
||||||
retval = true;
|
retval = true;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -55,7 +55,7 @@ regprocin(char *proname)
|
|||||||
(RegProcedure) F_CHAR16EQ,
|
(RegProcedure) F_CHAR16EQ,
|
||||||
(Datum) proname);
|
(Datum) proname);
|
||||||
|
|
||||||
procscan = heap_beginscan(proc, 0, NowTimeQual, 1, &key);
|
procscan = heap_beginscan(proc, 0, false, 1, &key);
|
||||||
if (!HeapScanIsValid(procscan))
|
if (!HeapScanIsValid(procscan))
|
||||||
{
|
{
|
||||||
heap_close(proc);
|
heap_close(proc);
|
||||||
@ -114,7 +114,7 @@ regprocout(RegProcedure proid)
|
|||||||
(RegProcedure) F_INT4EQ,
|
(RegProcedure) F_INT4EQ,
|
||||||
(Datum) proid);
|
(Datum) proid);
|
||||||
|
|
||||||
procscan = heap_beginscan(proc, 0, NowTimeQual, 1, &key);
|
procscan = heap_beginscan(proc, 0, false, 1, &key);
|
||||||
if (!HeapScanIsValid(procscan))
|
if (!HeapScanIsValid(procscan))
|
||||||
{
|
{
|
||||||
heap_close(proc);
|
heap_close(proc);
|
||||||
@ -192,7 +192,7 @@ oid8types(Oid (*oidArray)[])
|
|||||||
(RegProcedure) F_INT4EQ,
|
(RegProcedure) F_INT4EQ,
|
||||||
(Datum) *sp);
|
(Datum) *sp);
|
||||||
|
|
||||||
typescan = heap_beginscan(type, 0, NowTimeQual, 1, &key);
|
typescan = heap_beginscan(type, 0, false, 1, &key);
|
||||||
if (!HeapScanIsValid(typescan))
|
if (!HeapScanIsValid(typescan))
|
||||||
{
|
{
|
||||||
heap_close(type);
|
heap_close(type);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -350,7 +350,7 @@ gethilokey(Oid relid,
|
|||||||
key[0].sk_argument = ObjectIdGetDatum(relid);
|
key[0].sk_argument = ObjectIdGetDatum(relid);
|
||||||
key[1].sk_argument = Int16GetDatum((int16) attnum);
|
key[1].sk_argument = Int16GetDatum((int16) attnum);
|
||||||
key[2].sk_argument = ObjectIdGetDatum(opid);
|
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);
|
tuple = heap_getnext(sdesc, 0, (Buffer *) NULL);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -121,7 +121,7 @@ SetDefine(char *querystr, char *typename)
|
|||||||
oidKey[0].sk_argument = ObjectIdGetDatum(setoid);
|
oidKey[0].sk_argument = ObjectIdGetDatum(setoid);
|
||||||
pg_proc_scan = heap_beginscan(procrel,
|
pg_proc_scan = heap_beginscan(procrel,
|
||||||
0,
|
0,
|
||||||
SelfTimeQual,
|
true,
|
||||||
1,
|
1,
|
||||||
oidKey);
|
oidKey);
|
||||||
tup = heap_getnext(pg_proc_scan, 0, &buffer);
|
tup = heap_getnext(pg_proc_scan, 0, &buffer);
|
||||||
|
4
src/backend/utils/cache/catcache.c
vendored
4
src/backend/utils/cache/catcache.c
vendored
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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:
|
* Notes:
|
||||||
* XXX This needs to use exception.h to handle recovery when
|
* XXX This needs to use exception.h to handle recovery when
|
||||||
@ -973,7 +973,7 @@ SearchSysCache(struct catcache * cache,
|
|||||||
*/
|
*/
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
|
|
||||||
sd = heap_beginscan(relation, 0, NowTimeQual,
|
sd = heap_beginscan(relation, 0, false,
|
||||||
cache->cc_nkeys, cache->cc_skey);
|
cache->cc_nkeys, cache->cc_skey);
|
||||||
|
|
||||||
/* should this buffer be ReleaseBuffer'd? --djm 8/20/96 */
|
/* should this buffer be ReleaseBuffer'd? --djm 8/20/96 */
|
||||||
|
12
src/backend/utils/cache/relcache.c
vendored
12
src/backend/utils/cache/relcache.c
vendored
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -383,7 +383,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
|
|||||||
if (!IsInitProcessingMode())
|
if (!IsInitProcessingMode())
|
||||||
RelationSetLockForRead(pg_class_desc);
|
RelationSetLockForRead(pg_class_desc);
|
||||||
pg_class_scan =
|
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_class_tuple = heap_getnext(pg_class_scan, 0, &buf);
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
@ -555,7 +555,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
|
|||||||
*/
|
*/
|
||||||
pg_attribute_desc = heap_openr(AttributeRelationName);
|
pg_attribute_desc = heap_openr(AttributeRelationName);
|
||||||
pg_attribute_scan =
|
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
|
* add attribute data to relation->rd_att
|
||||||
@ -726,7 +726,7 @@ RelationBuildRuleLock(Relation relation)
|
|||||||
*/
|
*/
|
||||||
pg_rewrite_desc = heap_openr(RewriteRelationName);
|
pg_rewrite_desc = heap_openr(RewriteRelationName);
|
||||||
pg_rewrite_scan =
|
pg_rewrite_scan =
|
||||||
heap_beginscan(pg_rewrite_desc, 0, NowTimeQual, 1, &key);
|
heap_beginscan(pg_rewrite_desc, 0, false, 1, &key);
|
||||||
pg_rewrite_tupdesc =
|
pg_rewrite_tupdesc =
|
||||||
RelationGetTupleDescriptor(pg_rewrite_desc);
|
RelationGetTupleDescriptor(pg_rewrite_desc);
|
||||||
|
|
||||||
@ -1728,7 +1728,7 @@ AttrDefaultFetch(Relation relation)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
iptr = &indexRes->heap_iptr;
|
iptr = &indexRes->heap_iptr;
|
||||||
tuple = heap_fetch(adrel, NowTimeQual, iptr, &buffer);
|
tuple = heap_fetch(adrel, false, iptr, &buffer);
|
||||||
pfree(indexRes);
|
pfree(indexRes);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
continue;
|
continue;
|
||||||
@ -1817,7 +1817,7 @@ RelCheckFetch(Relation relation)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
iptr = &indexRes->heap_iptr;
|
iptr = &indexRes->heap_iptr;
|
||||||
tuple = heap_fetch(rcrel, NowTimeQual, iptr, &buffer);
|
tuple = heap_fetch(rcrel, false, iptr, &buffer);
|
||||||
pfree(indexRes);
|
pfree(indexRes);
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
continue;
|
continue;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -59,7 +59,7 @@ GetDatabaseInfo(char *name, Oid *owner, char *path)
|
|||||||
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
|
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
|
||||||
NameEqualRegProcedure, NameGetDatum(name));
|
NameEqualRegProcedure, NameGetDatum(name));
|
||||||
|
|
||||||
scan = heap_beginscan(dbrel, 0, NowTimeQual, 1, &scanKey);
|
scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
|
||||||
if (!HeapScanIsValid(scan))
|
if (!HeapScanIsValid(scan))
|
||||||
elog(WARN, "GetDatabaseInfo: cannot begin scan of %s", DatabaseRelationName);
|
elog(WARN, "GetDatabaseInfo: cannot begin scan of %s", DatabaseRelationName);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -25,9 +25,6 @@
|
|||||||
|
|
||||||
#include "utils/tqual.h"
|
#include "utils/tqual.h"
|
||||||
|
|
||||||
static int4 SelfTimeQualData;
|
|
||||||
TimeQual SelfTimeQual = (TimeQual) &SelfTimeQualData;
|
|
||||||
|
|
||||||
extern bool PostgresIsInitialized;
|
extern bool PostgresIsInitialized;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -82,33 +79,23 @@ static bool HeapTupleSatisfiesItself(HeapTuple tuple);
|
|||||||
static bool HeapTupleSatisfiesNow(HeapTuple tuple);
|
static bool HeapTupleSatisfiesNow(HeapTuple tuple);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HeapTupleSatisfiesTimeQual --
|
* HeapTupleSatisfiesScope --
|
||||||
* True iff heap tuple satsifies a time qual.
|
* True iff heap tuple satsifies a time qual.
|
||||||
*
|
*
|
||||||
* Note:
|
* Note:
|
||||||
* Assumes heap tuple is valid.
|
* Assumes heap tuple is valid.
|
||||||
* Assumes time qual is valid.
|
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual)
|
HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (TransactionIdEquals(tuple->t_xmax, AmiTransactionId))
|
if (TransactionIdEquals(tuple->t_xmax, AmiTransactionId))
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
if (qual == SelfTimeQual || heapisoverride())
|
if (seeself == true || heapisoverride())
|
||||||
{
|
|
||||||
return (HeapTupleSatisfiesItself(tuple));
|
return (HeapTupleSatisfiesItself(tuple));
|
||||||
}
|
else
|
||||||
|
|
||||||
if (qual == NowTimeQual)
|
|
||||||
{
|
|
||||||
return (HeapTupleSatisfiesNow(tuple));
|
return (HeapTupleSatisfiesNow(tuple));
|
||||||
}
|
|
||||||
|
|
||||||
elog(WARN, "HeapTupleSatisfiesTimeQual: illegal time qual");
|
|
||||||
|
|
||||||
return (false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -123,13 +123,12 @@ extern Relation heap_openr(char *relationName);
|
|||||||
extern void heap_close(Relation relation);
|
extern void heap_close(Relation relation);
|
||||||
extern HeapScanDesc
|
extern HeapScanDesc
|
||||||
heap_beginscan(Relation relation, int atend,
|
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_rescan(HeapScanDesc sdesc, bool scanFromEnd, ScanKey key);
|
||||||
extern void heap_endscan(HeapScanDesc sdesc);
|
extern void heap_endscan(HeapScanDesc sdesc);
|
||||||
extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw, Buffer *b);
|
extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw, Buffer *b);
|
||||||
extern HeapTuple
|
extern HeapTuple
|
||||||
heap_fetch(Relation relation, TimeQual timeQual,
|
heap_fetch(Relation relation, bool seeself, ItemPointer tid, Buffer *b);
|
||||||
ItemPointer tid, Buffer *b);
|
|
||||||
extern Oid heap_insert(Relation relation, HeapTuple tup);
|
extern Oid heap_insert(Relation relation, HeapTuple tup);
|
||||||
extern int heap_delete(Relation relation, ItemPointer tid);
|
extern int heap_delete(Relation relation, ItemPointer tid);
|
||||||
extern int
|
extern int
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -33,7 +33,7 @@ typedef struct HeapScanDescData
|
|||||||
ItemPointerData rs_mntid; /* marked next tid */
|
ItemPointerData rs_mntid; /* marked next tid */
|
||||||
ItemPointerData rs_mcd; /* marked current delta XXX ??? */
|
ItemPointerData rs_mcd; /* marked current delta XXX ??? */
|
||||||
bool rs_atend; /* restart scan at end? */
|
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_cdelta; /* current delta in chain */
|
||||||
uint16 rs_nkeys; /* number of attributes in keys */
|
uint16 rs_nkeys; /* number of attributes in keys */
|
||||||
ScanKey rs_key; /* key descriptors */
|
ScanKey rs_key; /* key descriptors */
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -113,7 +113,7 @@ do \
|
|||||||
relation, \
|
relation, \
|
||||||
buffer, \
|
buffer, \
|
||||||
disk_page, \
|
disk_page, \
|
||||||
qual, \
|
seeself, \
|
||||||
nKeys, \
|
nKeys, \
|
||||||
key, \
|
key, \
|
||||||
result) \
|
result) \
|
||||||
@ -144,7 +144,7 @@ do \
|
|||||||
{ \
|
{ \
|
||||||
uint16 _infomask = _tuple->t_infomask; \
|
uint16 _infomask = _tuple->t_infomask; \
|
||||||
\
|
\
|
||||||
_res = HeapTupleSatisfiesTimeQual(_tuple, (qual)); \
|
_res = HeapTupleSatisfiesVisibility(_tuple, (seeself)); \
|
||||||
if (_tuple->t_infomask != _infomask) \
|
if (_tuple->t_infomask != _infomask) \
|
||||||
SetBufferCommitInfoNeedsSave(buffer); \
|
SetBufferCommitInfoNeedsSave(buffer); \
|
||||||
if (_res) \
|
if (_res) \
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -28,8 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
extern void
|
extern void
|
||||||
ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
|
ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
|
||||||
ScanDirection dir, TimeQual timeRange,
|
ScanDirection dir, Relation *returnRelation,
|
||||||
Relation *returnRelation, Pointer *returnScanDesc);
|
Pointer *returnScanDesc);
|
||||||
extern void ExecCloseR(Plan *node);
|
extern void ExecCloseR(Plan *node);
|
||||||
extern void ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent);
|
extern void ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent);
|
||||||
extern HeapScanDesc
|
extern HeapScanDesc
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -785,16 +785,6 @@ typedef struct ParamString
|
|||||||
char *val;
|
char *val;
|
||||||
} ParamString;
|
} ParamString;
|
||||||
|
|
||||||
/*
|
|
||||||
* TimeRange - specifies a time range
|
|
||||||
*/
|
|
||||||
typedef struct TimeRange
|
|
||||||
{
|
|
||||||
NodeTag type;
|
|
||||||
char *startDate;
|
|
||||||
char *endDate; /* snapshot if NULL */
|
|
||||||
} TimeRange;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RelExpr - relation expressions
|
* RelExpr - relation expressions
|
||||||
*/
|
*/
|
||||||
@ -803,7 +793,6 @@ typedef struct RelExpr
|
|||||||
NodeTag type;
|
NodeTag type;
|
||||||
char *relname; /* the relation name */
|
char *relname; /* the relation name */
|
||||||
bool inh; /* inheritance query */
|
bool inh; /* inheritance query */
|
||||||
TimeRange *timeRange; /* the time range */
|
|
||||||
} RelExpr;
|
} RelExpr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -887,14 +876,12 @@ typedef struct RangeTblEntry
|
|||||||
{
|
{
|
||||||
NodeTag type;
|
NodeTag type;
|
||||||
char *relname; /* real name of the relation */
|
char *relname; /* real name of the relation */
|
||||||
TimeRange *timeRange; /* time range */
|
|
||||||
char *refname; /* the reference name (specified in the
|
char *refname; /* the reference name (specified in the
|
||||||
* from clause) */
|
* from clause) */
|
||||||
Oid relid;
|
Oid relid;
|
||||||
bool inh; /* inheritance? */
|
bool inh; /* inheritance? */
|
||||||
bool archive; /* filled in by plan_archive */
|
bool archive; /* filled in by plan_archive */
|
||||||
bool inFromCl; /* comes from From Clause */
|
bool inFromCl; /* comes from From Clause */
|
||||||
TimeQual timeQual; /* filled in by pg_plan */
|
|
||||||
} RangeTblEntry;
|
} RangeTblEntry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -16,12 +16,6 @@
|
|||||||
#include <nodes/plannodes.h>
|
#include <nodes/plannodes.h>
|
||||||
#include <nodes/parsenodes.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
|
* prototypes for prepqual.h
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -29,8 +29,7 @@ extern int refnameRangeTablePosn(List *rtable, char *refname);
|
|||||||
extern RangeTblEntry *
|
extern RangeTblEntry *
|
||||||
addRangeTableEntry(ParseState *pstate,
|
addRangeTableEntry(ParseState *pstate,
|
||||||
char *relname, char *refname,
|
char *relname, char *refname,
|
||||||
bool inh, bool inFromCl,
|
bool inh, bool inFromCl);
|
||||||
TimeRange *timeRange);
|
|
||||||
extern List *
|
extern List *
|
||||||
expandAll(ParseState *pstate, char *relname, char *refname,
|
expandAll(ParseState *pstate, char *relname, char *refname,
|
||||||
int *this_resno);
|
int *this_resno);
|
||||||
@ -49,13 +48,9 @@ extern Const *make_const(Value *value);
|
|||||||
extern void param_type_init(Oid *typev, int nargs);
|
extern void param_type_init(Oid *typev, int nargs);
|
||||||
extern Oid param_type(int t);
|
extern Oid param_type(int t);
|
||||||
|
|
||||||
/* parser.c (was ylib.c) */
|
|
||||||
extern QueryTreeList *parser(char *str, Oid *typev, int nargs);
|
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 void handleTargetColname(ParseState *pstate, char **resname,
|
||||||
extern Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target);
|
|
||||||
extern void
|
|
||||||
handleTargetColname(ParseState *pstate, char **resname,
|
|
||||||
char *refname, char *colname);
|
char *refname, char *colname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* sysfunc.h--
|
|
||||||
* support for system functions
|
|
||||||
*
|
|
||||||
* -------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern char *SystemFunctionHandler(char *funct);
|
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -15,18 +15,12 @@
|
|||||||
|
|
||||||
#include <access/htup.h>
|
#include <access/htup.h>
|
||||||
|
|
||||||
typedef Pointer TimeQual;
|
|
||||||
|
|
||||||
/* Tuples valid as of StartTransactionCommand */
|
|
||||||
#define NowTimeQual ((TimeQual) NULL)
|
|
||||||
|
|
||||||
/* As above, plus updates in this command */
|
/* As above, plus updates in this command */
|
||||||
extern TimeQual SelfTimeQual;
|
|
||||||
|
|
||||||
extern void setheapoverride(bool on);
|
extern void setheapoverride(bool on);
|
||||||
extern bool heapisoverride(void);
|
extern bool heapisoverride(void);
|
||||||
|
|
||||||
extern bool HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual);
|
extern bool HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself);
|
||||||
|
|
||||||
|
|
||||||
#endif /* TQUAL_H */
|
#endif /* TQUAL_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user