Commit 79715390 authored by Bruce Momjian's avatar Bruce Momjian

heap_fetch requires buffer pointer, must be released; heap_getnext

no longer returns buffer pointer, can be gotten from scan;
	descriptor; bootstrap can create multi-key indexes;
pg_procname index now is multi-key index; oidint2, oidint4, oidname
are gone (must be removed from regression tests); use System Cache
rather than sequential scan in many places; heap_modifytuple no
longer takes buffer parameter; remove unused buffer parameter in
a few other functions; oid8 is not index-able; remove some use of
single-character variable names; cleanup Buffer variables usage
and scan descriptor looping; cleaned up allocation and freeing of
tuples; 18k lines of diff;
parent 31de2c94
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.38 1998/06/15 19:27:44 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.39 1998/08/19 02:00:53 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
......@@ -736,13 +736,6 @@ heap_copytuple(HeapTuple tuple)
if (!HeapTupleIsValid(tuple))
return (NULL);
/* XXX For now, just prevent an undetectable executor related error */
if (tuple->t_len > MAXTUPLEN)
{
elog(ERROR, "palloctup: cannot handle length %d tuples",
tuple->t_len);
}
newTuple = (HeapTuple) palloc(tuple->t_len);
memmove((char *) newTuple, (char *) tuple, (int) tuple->t_len);
return (newTuple);
......@@ -863,11 +856,11 @@ heap_formtuple(TupleDesc tupleDescriptor,
* heap_modifytuple
*
* forms a new tuple from an old tuple and a set of replacement values.
* returns a new palloc'ed tuple.
* ----------------
*/
HeapTuple
heap_modifytuple(HeapTuple tuple,
Buffer buffer,
Relation relation,
Datum replValue[],
char replNull[],
......@@ -879,7 +872,6 @@ heap_modifytuple(HeapTuple tuple,
char *nulls;
bool isNull;
HeapTuple newTuple;
int madecopy;
uint8 infomask;
/* ----------------
......@@ -887,26 +879,11 @@ heap_modifytuple(HeapTuple tuple,
* ----------------
*/
Assert(HeapTupleIsValid(tuple));
Assert(BufferIsValid(buffer) || RelationIsValid(relation));
Assert(HeapTupleIsValid(tuple));
Assert(RelationIsValid(relation));
Assert(PointerIsValid(replValue));
Assert(PointerIsValid(replNull));
Assert(PointerIsValid(repl));
/* ----------------
* if we're pointing to a disk page, then first
* make a copy of our tuple so that all the attributes
* are available. XXX this is inefficient -cim
* ----------------
*/
madecopy = 0;
if (BufferIsValid(buffer) == true)
{
relation = (Relation) BufferGetRelation(buffer);
tuple = heap_copytuple(tuple);
madecopy = 1;
}
numberOfAttributes = RelationGetRelationTupleForm(relation)->relnatts;
/* ----------------
......@@ -933,10 +910,7 @@ heap_modifytuple(HeapTuple tuple,
}
else if (repl[attoff] != 'r')
{
elog(ERROR, "heap_modifytuple: repl is \\%3d", repl[attoff]);
}
else
{ /* == 'r' */
value[attoff] = replValue[attoff];
......@@ -961,18 +935,8 @@ heap_modifytuple(HeapTuple tuple,
(char *) &tuple->t_oid,
((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
newTuple->t_infomask = infomask;
newTuple->t_natts = numberOfAttributes; /* fix t_natts just in
* case */
/* ----------------
* if we made a copy of the tuple, then free it.
* ----------------
*/
if (madecopy)
pfree(tuple);
return
newTuple;
newTuple->t_natts = numberOfAttributes; /* fix t_natts just in case */
return newTuple;
}
/* ----------------------------------------------------------------
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.31 1998/07/26 04:30:16 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.32 1998/08/19 02:00:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -46,8 +46,7 @@ typtoout(Oid type)
0, 0, 0);
if (HeapTupleIsValid(typeTuple))
return ((Oid)
((TypeTupleForm) GETSTRUCT(typeTuple))->typoutput);
return ((Oid) ((TypeTupleForm) GETSTRUCT(typeTuple))->typoutput);
elog(ERROR, "typtoout: Cache lookup of type %d failed", type);
return (InvalidOid);
......@@ -63,8 +62,7 @@ gettypelem(Oid type)
0, 0, 0);
if (HeapTupleIsValid(typeTuple))
return ((Oid)
((TypeTupleForm) GETSTRUCT(typeTuple))->typelem);
return ((Oid) ((TypeTupleForm) GETSTRUCT(typeTuple))->typelem);
elog(ERROR, "typtoout: Cache lookup of type %d failed", type);
return (InvalidOid);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.41 1998/07/12 21:29:13 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.42 1998/08/19 02:00:56 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
......@@ -327,7 +327,8 @@ TupleDescInitEntry(TupleDesc desc,
* -cim 6/14/90
* ----------------
*/
tuple = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(typeid),
tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(typeid),
0, 0, 0);
if (!HeapTupleIsValid(tuple))
{
......
......@@ -87,7 +87,6 @@ gistbuild(Relation heap,
PredInfo *predInfo)
{
HeapScanDesc scan;
Buffer buffer;
AttrNumber i;
HeapTuple htup;
IndexTuple itup;
......@@ -112,14 +111,15 @@ gistbuild(Relation heap,
*oldPred;
GISTSTATE giststate;
GISTENTRY tmpcentry;
Buffer buffer = InvalidBuffer;
bool *compvec;
/* GiSTs only know how to do stupid locking now */
RelationSetLockForWrite(index);
setheapoverride(TRUE); /* so we can see the new pg_index tuple */
setheapoverride(true); /* so we can see the new pg_index tuple */
initGISTstate(&giststate, index);
setheapoverride(FALSE);
setheapoverride(false);
pred = predInfo->pred;
oldPred = predInfo->oldPred;
......@@ -170,15 +170,13 @@ gistbuild(Relation heap,
econtext = NULL;
}
#endif /* OMIT_PARTIAL_INDEX */
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
htup = heap_getnext(scan, 0, &buffer);
/* int the tuples as we insert them */
nh = ni = 0;
for (; HeapTupleIsValid(htup); htup = heap_getnext(scan, 0, &buffer))
{
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(scan, 0)))
{
nh++;
/*
......@@ -240,8 +238,7 @@ gistbuild(Relation heap,
attoff,
attnum,
finfo,
&attnull,
buffer);
&attnull);
nulls[attoff] = (attnull ? 'n' : ' ');
}
......@@ -302,8 +299,8 @@ gistbuild(Relation heap,
* flushed. We close them to guarantee that they will be.
*/
hrelid = heap->rd_id;
irelid = index->rd_id;
hrelid = RelationGetRelid(heap);
irelid = RelationGetRelid(index);
heap_close(heap);
index_close(index);
......@@ -1165,11 +1162,13 @@ initGISTstate(GISTSTATE *giststate, Relation index)
fmgr_info(equal_proc, &giststate->equalFn);
/* see if key type is different from type of attribute being indexed */
htup = SearchSysCacheTuple(INDEXRELID, ObjectIdGetDatum(index->rd_id),
htup = SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(index)),
0, 0, 0);
itupform = (IndexTupleForm) GETSTRUCT(htup);
if (!HeapTupleIsValid(htup))
elog(ERROR, "initGISTstate: index %d not found", index->rd_id);
elog(ERROR, "initGISTstate: index %d not found",
RelationGetRelid(index));
giststate->haskeytype = itupform->indhaskeytype;
if (giststate->haskeytype)
{
......
......@@ -284,12 +284,12 @@ gistdropscan(IndexScanDesc s)
}
void
gistadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum)
gistadjscans(Relation rel, int op, BlockNumber blkno, OffsetNumber offnum)
{
GISTScanList l;
Oid relid;
relid = r->rd_id;
relid = RelationGetRelid(rel);
for (l = GISTScans; l != (GISTScanList) NULL; l = l->gsl_next)
{
if (l->gsl_scan->relation->rd_id == relid)
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.19 1998/07/27 19:37:35 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.20 1998/08/19 02:01:00 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
......@@ -53,7 +53,6 @@ hashbuild(Relation heap,
PredInfo *predInfo)
{
HeapScanDesc hscan;
Buffer buffer;
HeapTuple htup;
IndexTuple itup;
TupleDesc htupdesc,
......@@ -65,6 +64,7 @@ hashbuild(Relation heap,
nitups;
int i;
HashItem hitem;
Buffer buffer = InvalidBuffer;
#ifndef OMIT_PARTIAL_INDEX
ExprContext *econtext;
......@@ -120,14 +120,13 @@ hashbuild(Relation heap,
}
#endif /* OMIT_PARTIAL_INDEX */
/* start a heap scan */
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
htup = heap_getnext(hscan, 0, &buffer);
/* build the index */
nhtups = nitups = 0;
for (; HeapTupleIsValid(htup); htup = heap_getnext(hscan, 0, &buffer))
/* start a heap scan */
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(hscan, 0)))
{
nhtups++;
......@@ -193,8 +192,7 @@ hashbuild(Relation heap,
attoff,
attnum,
finfo,
&attnull,
buffer);
&attnull);
nulls[attoff] = (attnull ? 'n' : ' ');
}
......@@ -248,8 +246,8 @@ hashbuild(Relation heap,
*/
if (IsNormalProcessingMode())
{
hrelid = heap->rd_id;
irelid = index->rd_id;
hrelid = RelationGetRelid(heap);
irelid = RelationGetRelid(index);
heap_close(heap);
index_close(index);
UpdateStats(hrelid, nhtups, true);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.9 1998/04/26 04:05:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.10 1998/08/19 02:01:02 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
......@@ -133,6 +133,18 @@ hashoid(Oid key)
return ((uint32) ~key);
}
uint32
hashoid8(Oid key[])
{
int i;
uint32 result = 0;
for (i=0; i < 8; i++)
result = result ^ (~(uint32)key[i]);
return result;
}
#define PRIME1 37
#define PRIME2 1048583
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.14 1998/06/15 19:27:50 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.15 1998/08/19 02:01:04 momjian Exp $
*
* NOTES
* Because we can be doing an index scan on a relation while we
......@@ -90,7 +90,7 @@ _hash_adjscans(Relation rel, ItemPointer tid)
HashScanList l;
Oid relid;
relid = rel->rd_id;
relid = RelationGetRelid(rel);
for (l = HashScans; l != (HashScanList) NULL; l = l->hashsl_next)
{
if (relid == l->hashsl_scan->relation->rd_id)
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.12 1998/06/15 19:27:53 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.13 1998/08/19 02:01:09 momjian Exp $
*
* NOTES
* many of the old access method routines have been turned into
......@@ -216,14 +216,15 @@ IndexScanMarkPosition(IndexScanDesc scan)
if (scan->flags & ScanUncheckedPrevious)
{
result =
index_getnext(scan, BackwardScanDirection);
result = index_getnext(scan, BackwardScanDirection);
if (result != NULL)
{
scan->previousItemData = result->index_iptr;
pfree(result);
}
else
ItemPointerSetInvalid(&scan->previousItemData);
}
else if (scan->flags & ScanUncheckedNext)
{
......@@ -231,7 +232,10 @@ IndexScanMarkPosition(IndexScanDesc scan)
index_getnext(scan, ForwardScanDirection);
if (result != NULL)
{
scan->nextItemData = result->index_iptr;
pfree(result);
}
else
ItemPointerSetInvalid(&scan->nextItemData);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.22 1998/06/15 18:39:23 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.23 1998/08/19 02:01:10 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
......@@ -331,8 +331,7 @@ index_getnext(IndexScanDesc scan,
* have the am's gettuple proc do all the work.
* ----------------
*/
result = (RetrieveIndexResult)
fmgr(procedure, scan, direction);
result = (RetrieveIndexResult)fmgr(procedure, scan, direction);
return result;
}
......@@ -376,8 +375,7 @@ GetIndexValue(HeapTuple tuple,
int attOff,
AttrNumber attrNums[],
FuncIndexInfo *fInfo,
bool *attNull,
Buffer buffer)
bool *attNull)
{
Datum returnVal;
bool isNull;
......
......@@ -8,13 +8,14 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.25 1998/08/11 22:39:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.26 1998/08/19 02:01:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "miscadmin.h"
#include "access/heapam.h"
#include "access/istrat.h"
#include "catalog/catname.h"
......@@ -22,6 +23,7 @@
#include "catalog/pg_amproc.h"
#include "catalog/pg_index.h"
#include "catalog/pg_operator.h"
#include "utils/syscache.h"
#include "fmgr.h"
#include "utils/memutils.h" /* could have been access/itup.h */
......@@ -30,8 +32,7 @@ static bool StrategyEvaluationIsValid(StrategyEvaluation evaluation);
static bool
StrategyExpressionIsValid(StrategyExpression expression,
StrategyNumber maxStrategy);
static ScanKey
StrategyMapGetScanKeyEntry(StrategyMap map,
static ScanKey StrategyMapGetScanKeyEntry(StrategyMap map,
StrategyNumber strategyNumber);
static bool
StrategyOperatorIsValid(StrategyOperator operator,
......@@ -95,8 +96,7 @@ IndexStrategyGetStrategyMap(IndexStrategy indexStrategy,
Assert(AttributeNumberIsValid(attrNum));
maxStrategyNum = AMStrategies(maxStrategyNum); /* XXX */
return
&indexStrategy->strategyMapData[maxStrategyNum * (attrNum - 1)];
return &indexStrategy->strategyMapData[maxStrategyNum * (attrNum - 1)];
}
/*
......@@ -108,8 +108,7 @@ AttributeNumberGetIndexStrategySize(AttrNumber maxAttributeNumber,
StrategyNumber maxStrategyNumber)
{
maxStrategyNumber = AMStrategies(maxStrategyNumber); /* XXX */
return
maxAttributeNumber * maxStrategyNumber * sizeof(ScanKeyData);
return maxAttributeNumber * maxStrategyNumber * sizeof(ScanKeyData);
}
#ifdef USE_ASSERT_CHECKING
......@@ -483,39 +482,52 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
Oid operatorObjectId,
ScanKey entry)
{
HeapScanDesc scan;
ScanKeyData scanKeyData;
HeapTuple tuple;
HeapScanDesc scan = NULL;
ScanKeyEntryInitialize(&scanKeyData, 0,
ObjectIdAttributeNumber,
F_OIDEQ,
ObjectIdGetDatum(operatorObjectId));
if (!IsBootstrapProcessingMode())
{
tuple = SearchSysCacheTuple(OPROID,
ObjectIdGetDatum(operatorObjectId),
0, 0, 0);
}
else
{
ScanKeyData scanKeyData;
ScanKeyEntryInitialize(&scanKeyData, 0,
ObjectIdAttributeNumber,
F_OIDEQ,
ObjectIdGetDatum(operatorObjectId));
scan = heap_beginscan(operatorRelation, false, SnapshotNow,
1, &scanKeyData);
scan = heap_beginscan(operatorRelation, false, SnapshotNow,
1, &scanKeyData);
tuple = heap_getnext(scan, 0);
}
tuple = heap_getnext(scan, false, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
{
if (IsBootstrapProcessingMode())
heap_endscan(scan);
elog(ERROR, "OperatorObjectIdFillScanKeyEntry: unknown operator %lu",
(uint32) operatorObjectId);
}
entry->sk_flags = 0;
entry->sk_procedure =
((OperatorTupleForm) GETSTRUCT(tuple))->oprcode;
entry->sk_procedure = ((OperatorTupleForm) GETSTRUCT(tuple))->oprcode;
fmgr_info(entry->sk_procedure, &entry->sk_func);
entry->sk_nargs = entry->sk_func.fn_nargs;
if (IsBootstrapProcessingMode())
heap_endscan(scan);
if (!RegProcedureIsValid(entry->sk_procedure))
{
elog(ERROR,
"OperatorObjectIdFillScanKeyEntry: no procedure for operator %lu",
(uint32) operatorObjectId);
}
heap_endscan(scan);
}
......@@ -532,28 +544,38 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
StrategyNumber maxSupportNumber,
AttrNumber maxAttributeNumber)
{
Relation relation;
Relation relation = NULL;
HeapScanDesc scan = NULL;
ScanKeyData entry[2];
Relation operatorRelation;
HeapScanDesc scan;
HeapTuple tuple;
ScanKeyData entry[2];
StrategyMap map;
AttrNumber attributeNumber;
int attributeIndex;
Oid operatorClassObjectId[MaxIndexAttributeNumber];
maxStrategyNumber = AMStrategies(maxStrategyNumber);
ScanKeyEntryInitialize(&entry[0], 0, Anum_pg_index_indexrelid,
F_OIDEQ,
ObjectIdGetDatum(indexObjectId));
if (!IsBootstrapProcessingMode())
{
tuple = SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(indexObjectId),
0, 0, 0);
}
else
{
ScanKeyEntryInitialize(&entry[0], 0, Anum_pg_index_indexrelid,
F_OIDEQ,
ObjectIdGetDatum(indexObjectId));
relation = heap_openr(IndexRelationName);
scan = heap_beginscan(relation, false, SnapshotNow, 1, entry);
tuple = heap_getnext(scan, 0);
}
relation = heap_openr(IndexRelationName);
scan = heap_beginscan(relation, false, SnapshotNow, 1, entry);
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "IndexSupportInitialize: corrupted catalogs");
maxStrategyNumber = AMStrategies(maxStrategyNumber);
/*
* XXX note that the following assumes the INDEX tuple is well formed
* and that the key[] and class[] are 0 terminated.
......@@ -574,9 +596,12 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
operatorClassObjectId[attributeIndex] = iform->indclass[attributeIndex];
}
heap_endscan(scan);
heap_close(relation);
if (IsBootstrapProcessingMode())
{
heap_endscan(scan);
heap_close(relation);
}
/* if support routines exist for this access method, load them */
if (maxSupportNumber > 0)
{
......@@ -606,8 +631,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
{
form = (Form_pg_amproc) GETSTRUCT(tuple);
loc[(form->amprocnum - 1)] = form->amproc;
......@@ -647,8 +671,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
{
Form_pg_amop form;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.16 1998/04/26 04:05:19 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.17 1998/08/19 02:01:13 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
......@@ -30,81 +30,96 @@
int32
btint2cmp(int16 a, int16 b)
{
return ((int32) (a - b));
return (int32) (a - b);
}
int32
btint4cmp(int32 a, int32 b)
{
return (a - b);
return a - b;
}
int32
btint24cmp(int16 a, int32 b)
{
return (((int32) a) - b);
return ((int32) a) - b;
}
int32
btint42cmp(int32 a, int16 b)
{
return (a - ((int32) b));
return a - ((int32) b);
}
int32
btfloat4cmp(float32 a, float32 b)
{
if (*a > *b)
return (1);
return 1;
else if (*a == *b)
return (0);
return 0;
else
return (-1);
return -1;
}
int32
btfloat8cmp(float64 a, float64 b)
{
if (*a > *b)
return (1);
return 1;
else if (*a == *b)
return (0);
return 0;
else
return (-1);
return -1;
}
int32
btoidcmp(Oid a, Oid b)
{
if (a > b)
return (1);
return 1;
else if (a == b)
return (0);
return 0;
else
return (-1);
return -1;
}
int32
btoid8cmp(Oid a[], Oid b[])
{
int i;
for (i=0; i < 8; i++)
/* we use this because we need the int4gt, etc */
if (!int4eq(a[i], b[i]))
if (int4gt(a[i], b[i]))
return 1;
else
return -1;
return 0;
}
int32
btabstimecmp(AbsoluteTime a, AbsoluteTime b)
{
if (AbsoluteTimeIsBefore(a, b))
return (-1);
return -1;
else if (AbsoluteTimeIsBefore(b, a))
return (1);
return 1;
else
return (0);
return 0;
}
int32
btcharcmp(char a, char b)
{
return ((int32) ((uint8) a - (uint8) b));
return (int32) ((uint8) a - (uint8) b);
}
int32
btnamecmp(NameData *a, NameData *b)
{
return (strncmp(a->data, b->data, NAMEDATALEN));
return strncmp(a->data, b->data, NAMEDATALEN);
}
int32
......@@ -162,7 +177,7 @@ bttextcmp(struct varlena * a, struct varlena * b)
#endif
if (res != 0 || VARSIZE(a) == VARSIZE(b))
return (res);
return res;
/*
* The two strings are the same in the first len bytes, and they are
......@@ -170,7 +185,7 @@ bttextcmp(struct varlena * a, struct varlena * b)
*/
if (VARSIZE(a) < VARSIZE(b))
return (-1);
return -1;
else
return (1);
return 1;
}
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.27 1998/07/27 19:37:39 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.28 1998/08/19 02:01:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -53,7 +53,8 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
BlockNumber blkno;
int natts = rel->rd_rel->relnatts;
InsertIndexResult res;
Buffer buffer;
itup = &(btitem->bti_itup);
/* we need a scan key to do our search, so build one */
......@@ -120,11 +121,12 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
{ /* they're equal */
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
itup = &(btitem->bti_itup);
htup = heap_fetch(heapRel, SnapshotSelf, &(itup->t_tid), NULL);
htup = heap_fetch(heapRel, SnapshotSelf, &(itup->t_tid), &buffer);
if (htup != (HeapTuple) NULL)
{ /* it is a duplicate */
elog(ERROR, "Cannot insert a duplicate key into a unique index");
}
/* htup null so no buffer to release */
/* get next offnum */
if (offset < maxoff)
offset = OffsetNumberNext(offset);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.28 1998/07/30 05:04:49 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.29 1998/08/19 02:01:16 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
......@@ -66,7 +66,6 @@ btbuild(Relation heap,
PredInfo *predInfo)
{
HeapScanDesc hscan;
Buffer buffer;
HeapTuple htup;
IndexTuple itup;
TupleDesc htupdesc,
......@@ -113,7 +112,7 @@ btbuild(Relation heap,
#endif
/* see if index is unique */
isunique = IndexIsUniqueNoCache(RelationGetRelationId(index));
isunique = IndexIsUniqueNoCache(RelationGetRelid(index));
/* initialize the btree index metadata page (if this is a new index) */
if (oldPred == NULL)
......@@ -155,9 +154,6 @@ btbuild(Relation heap,
#endif /* OMIT_PARTIAL_INDEX */
/* start a heap scan */
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
htup = heap_getnext(hscan, 0, &buffer);
/* build the index */
nhtups = nitups = 0;
......@@ -167,9 +163,10 @@ btbuild(Relation heap,
res = (InsertIndexResult) NULL;
}
for (; HeapTupleIsValid(htup); htup = heap_getnext(hscan, 0, &buffer))
{
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(hscan, 0)))
{
nhtups++;
/*
......@@ -228,8 +225,7 @@ btbuild(Relation heap,
attoff,
attnum,
finfo,
&attnull,
buffer);
&attnull);
nulls[attoff] = (attnull ? 'n' : ' ');
}
......@@ -323,8 +319,8 @@ btbuild(Relation heap,
*/
if (IsNormalProcessingMode())
{
hrelid = heap->rd_id;
irelid = index->rd_id;
hrelid = RelationGetRelid(heap);
irelid = RelationGetRelid(index);
heap_close(heap);
index_close(index);
UpdateStats(hrelid, nhtups, true);
......@@ -371,7 +367,7 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
btitem = _bt_formitem(itup);
res = _bt_doinsert(rel, btitem,
IndexIsUnique(RelationGetRelationId(rel)), heapRel);
IndexIsUnique(RelationGetRelid(rel)), heapRel);
pfree(btitem);
pfree(itup);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.15 1998/07/30 05:04:50 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.16 1998/08/19 02:01:17 momjian Exp $
*
*
* NOTES
......@@ -96,10 +96,10 @@ _bt_adjscans(Relation rel, ItemPointer tid, int op)
BTScanList l;
Oid relid;
relid = rel->rd_id;
relid = RelationGetRelid(rel);
for (l = BTScans; l != (BTScanList) NULL; l = l->btsl_next)
{
if (relid == l->btsl_scan->relation->rd_id)
if (relid == RelationGetRelid(l->btsl_scan->relation))
_bt_scandel(l->btsl_scan, op,
ItemPointerGetBlockNumber(tid),
ItemPointerGetOffsetNumber(tid));
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.20 1998/06/15 19:27:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.21 1998/08/19 02:01:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -61,8 +61,7 @@ _bt_mkscankey(Relation rel, IndexTuple itup)
proc = index_getprocid(rel, i + 1, BTORDER_PROC);
flag = 0x0;
}
ScanKeyEntryInitialize(&skey[i],
flag, (AttrNumber) (i + 1), proc, arg);
ScanKeyEntryInitialize(&skey[i], flag, (AttrNumber) (i + 1), proc, arg);
}
return (skey);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.25 1998/07/27 19:37:41 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.26 1998/08/19 02:01:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -86,7 +86,6 @@ rtbuild(Relation heap,
PredInfo *predInfo)
{
HeapScanDesc scan;
Buffer buffer;
AttrNumber i;
HeapTuple htup;
IndexTuple itup;
......@@ -95,6 +94,7 @@ rtbuild(Relation heap,
InsertIndexResult res;
Datum *d;
bool *nulls;
Buffer buffer = InvalidBuffer;
int nb,
nh,
ni;
......@@ -164,15 +164,14 @@ rtbuild(Relation heap,
slot = NULL;
}
#endif /* OMIT_PARTIAL_INDEX */
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
htup = heap_getnext(scan, 0, &buffer);
/* count the tuples as we insert them */
nh = ni = 0;
for (; HeapTupleIsValid(htup); htup = heap_getnext(scan, 0, &buffer))
{
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(scan, 0)))
{
nh++;
/*
......@@ -234,8 +233,7 @@ rtbuild(Relation heap,
attoff,
attnum,
finfo,
&attnull,
buffer);
&attnull);
nulls[attoff] = (attnull ? 'n' : ' ');
}
......@@ -278,8 +276,8 @@ rtbuild(Relation heap,
* flushed. We close them to guarantee that they will be.
*/
hrelid = heap->rd_id;
irelid = index->rd_id;
hrelid = RelationGetRelid(heap);
irelid = RelationGetRelid(index);
heap_close(heap);
index_close(index);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.16 1998/06/15 19:28:01 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.17 1998/08/19 02:01:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -290,10 +290,10 @@ rtadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum)
RTScanList l;
Oid relid;
relid = r->rd_id;
relid = RelationGetRelid(r);
for (l = RTScans; l != (RTScanList) NULL; l = l->rtsl_next)
{
if (l->rtsl_scan->relation->rd_id == relid)
if (RelationGetRelid(l->rtsl_scan->relation) == relid)
rtadjone(l->rtsl_scan, op, blkno, offnum);
}
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.19 1998/08/06 05:12:16 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.20 1998/08/19 02:01:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -78,8 +78,8 @@ static Oid objectid;
int ival;
}
%type <list> boot_arg_list
%type <ielem> boot_index_params boot_index_on
%type <list> boot_index_params
%type <ielem> boot_index_param
%type <ival> boot_const boot_ident
%type <ival> optbootstrap optoideq boot_tuple boot_tuplelist
......@@ -225,15 +225,12 @@ Boot_InsertStmt:
Boot_DeclareIndexStmt:
XDECLARE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN
{
List *params;
DO_START;
params = lappend(NIL, (List*)$9);
DefineIndex(LexIDStr($5),
LexIDStr($3),
LexIDStr($7),
params, NIL, 0, 0, NIL);
$9, NIL, 0, 0, NIL);
DO_END;
}
;
......@@ -241,39 +238,21 @@ Boot_DeclareIndexStmt:
Boot_BuildIndsStmt:
XBUILD INDICES { build_indices(); }
boot_index_params:
boot_index_on boot_ident
{
IndexElem *n = (IndexElem*)$1;
n->class = LexIDStr($2);
$$ = n;
}
boot_index_params COMMA boot_index_param { $$ = lappend($1, $3); }
| boot_index_param { $$ = lcons($1, NIL); }
;
boot_index_on:
boot_ident
{
IndexElem *n = makeNode(IndexElem);
n->name = LexIDStr($1);
$$ = n;
}
| boot_ident LPAREN boot_arg_list RPAREN
boot_index_param:
boot_ident boot_ident
{
IndexElem *n = makeNode(IndexElem);
n->name = LexIDStr($1);
n->args = (List*)$3;
n->class = LexIDStr($2);
$$ = n;
}
boot_arg_list:
boot_ident
{
$$ = lappend(NIL, makeString(LexIDStr($1)));
}
| boot_arg_list COMMA boot_ident
{
$$ = lappend((List*)$1, makeString(LexIDStr($3)));
}
optbootstrap:
XBOOTSTRAP { $$ = 1; }
| { $$ = 0; }
......
......@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.47 1998/07/27 19:37:43 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.48 1998/08/19 02:01:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -448,8 +448,8 @@ boot_openrel(char *relname)
{
int i;
struct typmap **app;
Relation rdesc;
HeapScanDesc sdesc;
Relation rel;
HeapScanDesc scan;
HeapTuple tup;
if (strlen(relname) >= NAMEDATALEN - 1)
......@@ -458,25 +458,27 @@ boot_openrel(char *relname)
if (Typ == (struct typmap **) NULL)
{
StartPortalAllocMode(DefaultAllocMode, 0);
rdesc = heap_openr(TypeRelationName);
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
for (i = 0; PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)); ++i);
heap_endscan(sdesc);
rel = heap_openr(TypeRelationName);
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
i = 0;
while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
++i;
heap_endscan(scan);
app = Typ = ALLOC(struct typmap *, i + 1);
while (i-- > 0)
*app++ = ALLOC(struct typmap, 1);
*app = (struct typmap *) NULL;
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
app = Typ;
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
{
(*app)->am_oid = tup->t_oid;
memmove((char *) &(*app++)->am_typ,
(char *) GETSTRUCT(tup),
sizeof((*app)->am_typ));
}
heap_endscan(sdesc);
heap_close(rdesc);
heap_endscan(scan);
heap_close(rel);
EndPortalAllocMode();
}
......@@ -505,7 +507,7 @@ boot_openrel(char *relname)
* defined yet.
*/
if (namestrcmp(&attrtypes[i]->attname, "attisset") == 0)
attrtypes[i]->attisset = get_attisset(reldesc->rd_id,
attrtypes[i]->attisset = get_attisset(RelationGetRelid(reldesc),
attrtypes[i]->attname.data);
else
attrtypes[i]->attisset = false;
......@@ -786,8 +788,8 @@ static int
gettype(char *type)
{
int i;
Relation rdesc;
HeapScanDesc sdesc;
Relation rel;
HeapScanDesc scan;
HeapTuple tup;
struct typmap **app;
......@@ -811,27 +813,27 @@ gettype(char *type)
}
if (DebugMode)
printf("bootstrap.c: External Type: %s\n", type);
rdesc = heap_openr(TypeRelationName);
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
rel = heap_openr(TypeRelationName);
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
i = 0;
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
++i;
heap_endscan(sdesc);
heap_endscan(scan);
app = Typ = ALLOC(struct typmap *, i + 1);
while (i-- > 0)
*app++ = ALLOC(struct typmap, 1);
*app = (struct typmap *) NULL;
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
app = Typ;
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
{
(*app)->am_oid = tup->t_oid;
memmove((char *) &(*app++)->am_typ,
(char *) GETSTRUCT(tup),
sizeof((*app)->am_typ));
}
heap_endscan(sdesc);
heap_close(rdesc);
heap_endscan(scan);
heap_close(rel);
return (gettype(type));
}
elog(ERROR, "Error: unknown type '%s'.\n", type);
......@@ -1167,7 +1169,7 @@ build_indices()
*/
heap = heap_openr(ILHead->il_heap);
if (!BootstrapAlreadySeen(heap->rd_id))
UpdateStats(heap->rd_id, 0, true);
if (!BootstrapAlreadySeen(RelationGetRelid(heap)))
UpdateStats(RelationGetRelid(heap), 0, true);
}
}
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.15 1998/02/26 04:30:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.16 1998/08/19 02:01:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -174,7 +174,7 @@ fillatt(TupleDesc tupleDesc)
for (i = 0; i < natts;)
{
tuple = SearchSysCacheTuple(TYPOID,
Int32GetDatum((*attributeP)->atttypid),
ObjectIdGetDatum((*attributeP)->atttypid),
0, 0, 0);
if (!HeapTupleIsValid(tuple))
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.14 1998/04/01 15:35:01 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.15 1998/08/19 02:01:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -155,7 +155,8 @@ AggregateCreate(char *aggName,
elog(ERROR, "AggregateCreate: bogus function '%s'", aggfinalfnName);
}
tup = SearchSysCacheTuple(AGGNAME, PointerGetDatum(aggName),
tup = SearchSysCacheTuple(AGGNAME,
PointerGetDatum(aggName),
ObjectIdGetDatum(xbase),
0, 0);
if (HeapTupleIsValid(tup))
......@@ -286,7 +287,7 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
tup = SearchSysCacheTuple(AGGNAME,
PointerGetDatum(aggName),
PointerGetDatum(basetype),
ObjectIdGetDatum(basetype),
0, 0);
if (!HeapTupleIsValid(tup))
elog(ERROR, "AggNameGetInitVal: cache lookup failed for aggregate '%s'",
......@@ -325,7 +326,8 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
strInitVal = textout(textInitVal);
heap_close(aggRel);
tup = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(transtype),
tup = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(transtype),
0, 0, 0);
if (!HeapTupleIsValid(tup))
{
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.26 1998/07/27 19:37:49 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.27 1998/08/19 02:01:36 momjian Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
......@@ -120,7 +120,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
*/
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
SnapshotSelf,
SnapshotSelf, /* no cache? */
3,
opKey);
......@@ -129,7 +129,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
* the proper return oid value.
* ----------------
*/
tup = heap_getnext(pg_operator_scan, 0, (Buffer *) 0);
tup = heap_getnext(pg_operator_scan, 0);
operatorObjectId = HeapTupleIsValid(tup) ? tup->t_oid : InvalidOid;
/* ----------------
......@@ -138,8 +138,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
*/
heap_endscan(pg_operator_scan);
return
operatorObjectId;
return operatorObjectId;
}
/* ----------------------------------------------------------------
......@@ -462,8 +461,6 @@ OperatorDef(char *operatorName,
HeapScanDesc pg_operator_scan;
HeapTuple tup;
Buffer buffer;
ItemPointerData itemPointerData;
char nulls[Natts_pg_operator];
char replaces[Natts_pg_operator];
Datum values[Natts_pg_operator];
......@@ -549,7 +546,7 @@ OperatorDef(char *operatorName,
PointerGetDatum(typeId),
0);
if (!PointerIsValid(tup))
if (!HeapTupleIsValid(tup))
func_error("OperatorDef", procedureName, nargs, typeId, NULL);
values[Anum_pg_operator_oprcode - 1] = ObjectIdGetDatum(tup->t_oid);
......@@ -693,7 +690,7 @@ OperatorDef(char *operatorName,
/* last three fields were filled in first */
/*
* If we are adding to an operator shell, get its t_ctid and a buffer.
* If we are adding to an operator shell, get its t_ctid
*/
pg_operator_desc = heap_openr(OperatorRelationName);
......@@ -705,30 +702,27 @@ OperatorDef(char *operatorName,
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
SnapshotSelf,
SnapshotSelf, /* no cache? */
3,
opKey);
tup = heap_getnext(pg_operator_scan, 0, &buffer);
tup = heap_getnext(pg_operator_scan, 0);
if (HeapTupleIsValid(tup))
{
tup = heap_modifytuple(tup,
buffer,
pg_operator_desc,
values,
nulls,
replaces);
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
setheapoverride(true);
heap_replace(pg_operator_desc, &itemPointerData, tup);
heap_replace(pg_operator_desc, &tup->t_ctid, tup);
setheapoverride(false);
}
else
elog(ERROR, "OperatorDef: no operator %d", other_oid);
heap_endscan(pg_operator_scan);
}
else
{
......@@ -777,8 +771,6 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
Relation pg_operator_desc;
HeapScanDesc pg_operator_scan;
HeapTuple tup;
Buffer buffer;
ItemPointerData itemPointerData;
char nulls[Natts_pg_operator];
char replaces[Natts_pg_operator];
Datum values[Natts_pg_operator];
......@@ -804,11 +796,11 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
SnapshotSelf,
SnapshotSelf, /* no cache? */
1,
opKey);
tup = heap_getnext(pg_operator_scan, 0, &buffer);
tup = heap_getnext(pg_operator_scan, 0);
/* if the commutator and negator are the same operator, do one update */
if (commId == negId)
......@@ -837,16 +829,13 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
}
tup = heap_modifytuple(tup,
buffer,
pg_operator_desc,
values,
nulls,
replaces);
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
setheapoverride(true);
heap_replace(pg_operator_desc, &itemPointerData, tup);
heap_replace(pg_operator_desc, &tup->t_ctid, tup);
setheapoverride(false);
}
......@@ -855,10 +844,6 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
heap_close(pg_operator_desc);
/* release the buffer properly */
if (BufferIsValid(buffer))
ReleaseBuffer(buffer);
return;
}
......@@ -869,24 +854,17 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(baseId);
replaces[Anum_pg_operator_oprcom - 1] = 'r';
tup = heap_modifytuple(tup,
buffer,
pg_operator_desc,
values,
nulls,
replaces);
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
setheapoverride(true);
heap_replace(pg_operator_desc, &itemPointerData, tup);
heap_replace(pg_operator_desc, &tup->t_ctid, tup);
setheapoverride(false);
values[Anum_pg_operator_oprcom - 1] = (Datum) NULL;
replaces[Anum_pg_operator_oprcom - 1] = ' ';
/* release the buffer properly */
if (BufferIsValid(buffer))
ReleaseBuffer(buffer);
}
/* check and update the negator, if necessary */
......@@ -894,34 +872,27 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
SnapshotSelf,
SnapshotSelf, /* no cache? */
1,
opKey);
tup = heap_getnext(pg_operator_scan, 0, &buffer);
tup = heap_getnext(pg_operator_scan, 0);
if (HeapTupleIsValid(tup) &&
!(OidIsValid(((OperatorTupleForm) GETSTRUCT(tup))->oprnegate)))
{
values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(baseId);
replaces[Anum_pg_operator_oprnegate - 1] = 'r';
tup = heap_modifytuple(tup,
buffer,
pg_operator_desc,
values,
nulls,
replaces);
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
setheapoverride(true);
heap_replace(pg_operator_desc, &itemPointerData, tup);
heap_replace(pg_operator_desc, &tup->t_ctid, tup);
setheapoverride(false);
}
/* release the buffer properly */
if (BufferIsValid(buffer))
ReleaseBuffer(buffer);
heap_endscan(pg_operator_scan);
heap_close(pg_operator_desc);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.18 1998/06/15 19:28:10 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.19 1998/08/19 02:01:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -57,7 +57,7 @@ ProcedureCreate(char *procedureName,
CommandDest dest)
{
int i;
Relation rdesc;
Relation rel;
HeapTuple tup;
bool defined;
uint16 parameterCount;
......@@ -258,23 +258,23 @@ ProcedureCreate(char *procedureName,
values[i++] = (Datum) fmgr(F_TEXTIN, prosrc); /* prosrc */
values[i++] = (Datum) fmgr(F_TEXTIN, probin); /* probin */
rdesc = heap_openr(ProcedureRelationName);
rel = heap_openr(ProcedureRelationName);
tupDesc = rdesc->rd_att;
tupDesc = rel->rd_att;
tup = heap_formtuple(tupDesc,
values,
nulls);
heap_insert(rdesc, tup);
heap_insert(rel, tup);
if (RelationGetRelationTupleForm(rdesc)->relhasindex)
if (RelationGetRelationTupleForm(rel)->relhasindex)
{
Relation idescs[Num_pg_proc_indices];
CatalogOpenIndices(Num_pg_proc_indices, Name_pg_proc_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_proc_indices, rdesc, tup);
CatalogIndexInsert(idescs, Num_pg_proc_indices, rel, tup);
CatalogCloseIndices(Num_pg_proc_indices, idescs);
}
heap_close(rdesc);
heap_close(rel);
return tup->t_oid;
}
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.26 1998/07/27 19:37:49 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.27 1998/08/19 02:01:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -21,6 +21,7 @@
#include "fmgr.h"
#include "miscadmin.h"
#include "parser/parse_func.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
......@@ -68,7 +69,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
scan = heap_beginscan(pg_type_desc,
0,
SnapshotSelf,
SnapshotSelf, /* cache? */
1,
typeKey);
......@@ -76,7 +77,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
* get the type tuple, if it exists.
* ----------------
*/
tup = heap_getnext(scan, 0, (Buffer *) 0);
tup = heap_getnext(scan, 0);
/* ----------------
* if no type tuple exists for the given type name, then
......@@ -99,8 +100,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
heap_endscan(scan);
*defined = (bool) ((TypeTupleForm) GETSTRUCT(tup))->typisdefined;
return
tup->t_oid;
return tup->t_oid;
}
/* ----------------------------------------------------------------
......@@ -143,8 +143,7 @@ TypeGet(char *typeName, /* name of type to be fetched */
*/
heap_close(pg_type_desc);
return
typeoid;
return typeoid;
}
/* ----------------------------------------------------------------
......@@ -312,11 +311,9 @@ TypeCreate(char *typeName,
char replaces[Natts_pg_type];
Datum values[Natts_pg_type];
Buffer buffer;
char *procname;
char *procs[4];
bool defined;
ItemPointerData itemPointerData;
NameData name;
TupleDesc tupDesc;
Oid argList[8];
......@@ -353,9 +350,7 @@ TypeCreate(char *typeName,
* ----------------
*/
if (externalSize == 0)
{
externalSize = -1; /* variable length */
}
/* ----------------
* initialize arrays needed by FormHeapTuple
......@@ -470,7 +465,7 @@ TypeCreate(char *typeName,
typeKey[0].sk_argument = PointerGetDatum(typeName);
pg_type_scan = heap_beginscan(pg_type_desc,
0,
SnapshotSelf,
SnapshotSelf, /* cache? */
1,
typeKey);
......@@ -480,21 +475,17 @@ TypeCreate(char *typeName,
* already there.
* ----------------
*/
tup = heap_getnext(pg_type_scan, 0, &buffer);
tup = heap_getnext(pg_type_scan, 0);
if (HeapTupleIsValid(tup))
{
tup = heap_modifytuple(tup,
buffer,
pg_type_desc,
values,
nulls,
replaces);
/* XXX may not be necessary */
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
setheapoverride(true);
heap_replace(pg_type_desc, &itemPointerData, tup);
heap_replace(pg_type_desc, &tup->t_ctid, tup);
setheapoverride(false);
typeObjectId = tup->t_oid;
......@@ -529,9 +520,7 @@ TypeCreate(char *typeName,
RelationUnsetLockForWrite(pg_type_desc);
heap_close(pg_type_desc);
return
typeObjectId;
return typeObjectId;
}
/* ----------------------------------------------------------------
......@@ -545,48 +534,42 @@ TypeRename(char *oldTypeName, char *newTypeName)
{
Relation pg_type_desc;
Relation idescs[Num_pg_type_indices];
Oid type_oid;
HeapTuple tup;
bool defined;
ItemPointerData itemPointerData;
/* check that that the new type is not already defined */
type_oid = TypeGet(newTypeName, &defined);
if (OidIsValid(type_oid) && defined)
elog(ERROR, "TypeRename: type %s already defined", newTypeName);
/* get the type tuple from the catalog index scan manager */
HeapTuple oldtup, newtup;
pg_type_desc = heap_openr(TypeRelationName);
tup = TypeNameIndexScan(pg_type_desc, oldTypeName);
/* ----------------
* change the name of the type
* ----------------
*/
if (HeapTupleIsValid(tup))
{
namestrcpy(&(((TypeTupleForm) GETSTRUCT(tup))->typname), newTypeName);
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
setheapoverride(true);
heap_replace(pg_type_desc, &itemPointerData, tup);
setheapoverride(false);
oldtup = SearchSysCacheTupleCopy(TYPNAME,
PointerGetDatum(oldTypeName),
0, 0, 0);
/* update the system catalog indices */
CatalogOpenIndices(Num_pg_type_indices, Name_pg_type_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_type_indices, pg_type_desc, tup);
CatalogCloseIndices(Num_pg_type_indices, idescs);
if (!HeapTupleIsValid(oldtup))
{
heap_close(pg_type_desc);
elog(ERROR, "TypeRename: type %s not defined", oldTypeName);
}
newtup = SearchSysCacheTuple(TYPNAME,
PointerGetDatum(newTypeName),
0, 0, 0);
if (HeapTupleIsValid(newtup))
{
pfree(oldtup);
heap_close(pg_type_desc);
elog(ERROR, "TypeRename: type %s already defined", newTypeName);
}
namestrcpy(&(((TypeTupleForm) GETSTRUCT(oldtup))->typname), newTypeName);
/* all done */
pfree(tup);
setheapoverride(true);
heap_replace(pg_type_desc, &oldtup->t_ctid, oldtup);
setheapoverride(false);
}
else
elog(ERROR, "TypeRename: type %s not defined", oldTypeName);
/* update the system catalog indices */
CatalogOpenIndices(Num_pg_type_indices, Name_pg_type_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_type_indices, pg_type_desc, oldtup);
CatalogCloseIndices(Num_pg_type_indices, idescs);
/* finish up */
pfree(oldtup);
heap_close(pg_type_desc);
}
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.13 1998/06/15 19:28:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.14 1998/08/19 02:01:58 momjian Exp $
*
* NOTES
* At the point the version is defined, 2 physical relations are created
......@@ -185,26 +185,26 @@ VersionCreate(char *vname, char *bname)
static void
setAttrList(char *bname)
{
Relation rdesc;
Relation rel;
int i = 0;
int maxattrs = 0;
char *attrname;
char temp_buf[512];
int notfirst = 0;
rdesc = heap_openr(bname);
if (rdesc == NULL)
rel = heap_openr(bname);
if (rel == NULL)
{
elog(ERROR, "Unable to expand all -- amopenr failed ");
return;
}
maxattrs = RelationGetNumberOfAttributes(rdesc);
maxattrs = RelationGetNumberOfAttributes(rel);
attr_list[0] = '\0';
for (i = maxattrs - 1; i > -1; --i)
{
attrname = (rdesc->rd_att->attrs[i]->attname).data;
attrname = (rel->rd_att->attrs[i]->attname).data;
if (notfirst == 1)
sprintf(temp_buf, ", %s = new.%s", attrname, attrname);
......@@ -216,7 +216,7 @@ setAttrList(char *bname)
strcat(attr_list, temp_buf);
}
heap_close(rdesc);
heap_close(rel);
return;
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.36 1998/07/27 19:37:50 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.37 1998/08/19 02:01:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -172,7 +172,6 @@ Async_Notify(char *relname)
HeapScanDesc sRel;
TupleDesc tdesc;
ScanKeyData key;
Buffer b;
Datum d,
value[3];
bool isnull;
......@@ -211,16 +210,14 @@ Async_Notify(char *relname)
value[0] = value[1] = value[2] = (Datum) 0;
value[Anum_pg_listener_notify - 1] = Int32GetDatum(1);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
{
d = heap_getattr(lTuple, Anum_pg_listener_notify,
tdesc, &isnull);
d = heap_getattr(lTuple, Anum_pg_listener_notify, tdesc, &isnull);
if (!DatumGetInt32(d))
{
rTuple = heap_modifytuple(lTuple, b, lRel, value, nulls, repl);
rTuple = heap_modifytuple(lTuple, lRel, value, nulls, repl);
heap_replace(lRel, &lTuple->t_ctid, rTuple);
}
ReleaseBuffer(b);
}
heap_endscan(sRel);
RelationUnsetLockForWrite(lRel);
......@@ -260,7 +257,6 @@ Async_NotifyAtCommit()
ScanKeyData key;
Datum d;
bool isnull;
Buffer b;
extern TransactionState CurrentTransactionState;
if (!pendingNotifies)
......@@ -286,7 +282,7 @@ Async_NotifyAtCommit()
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
tdesc = RelationGetTupleDescriptor(lRel);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
{
d = heap_getattr(lTuple, Anum_pg_listener_relname,
tdesc, &isnull);
......@@ -317,7 +313,6 @@ Async_NotifyAtCommit()
#endif
}
}
ReleaseBuffer(b);
}
heap_endscan(sRel);
RelationUnsetLockForWrite(lRel);
......@@ -400,11 +395,10 @@ Async_Listen(char *relname, int pid)
Datum values[Natts_pg_listener];
char nulls[Natts_pg_listener];
TupleDesc tdesc;
HeapScanDesc s;
HeapTuple htup,
tup;
HeapScanDesc scan;
HeapTuple tuple,
newtup;
Relation lDesc;
Buffer b;
Datum d;
int i;
bool isnull;
......@@ -431,22 +425,21 @@ Async_Listen(char *relname, int pid)
/* is someone already listening. One listener per relation */
tdesc = RelationGetTupleDescriptor(lDesc);
s = heap_beginscan(lDesc, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(s, 0, &b)))
scan = heap_beginscan(lDesc, 0, SnapshotNow, 0, (ScanKey) NULL);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
{
d = heap_getattr(htup, Anum_pg_listener_relname, tdesc,
d = heap_getattr(tuple, Anum_pg_listener_relname, tdesc,
&isnull);
relnamei = DatumGetPointer(d);
if (!strncmp(relnamei, relname, NAMEDATALEN))
{
d = heap_getattr(htup, Anum_pg_listener_pid, tdesc, &isnull);
d = heap_getattr(tuple, Anum_pg_listener_pid, tdesc, &isnull);
pid = DatumGetInt32(d);
if (pid == MyProcPid)
alreadyListener = 1;
}
ReleaseBuffer(b);
}
heap_endscan(s);
heap_endscan(scan);
if (alreadyListener)
{
......@@ -456,12 +449,12 @@ Async_Listen(char *relname, int pid)
}
tupDesc = lDesc->rd_att;
tup = heap_formtuple(tupDesc,
newtup = heap_formtuple(tupDesc,
values,
nulls);
heap_insert(lDesc, tup);
heap_insert(lDesc, newtup);
pfree(tup);
pfree(newtup);
/*
* if (alreadyListener) { elog(NOTICE,"Async_Listen: already one
......@@ -504,7 +497,8 @@ Async_Unlisten(char *relname, int pid)
Relation lDesc;
HeapTuple lTuple;
lTuple = SearchSysCacheTuple(LISTENREL, PointerGetDatum(relname),
lTuple = SearchSysCacheTuple(LISTENREL,
PointerGetDatum(relname),
Int32GetDatum(pid),
0, 0);
lDesc = heap_openr(ListenerRelationName);
......@@ -556,7 +550,6 @@ Async_NotifyFrontEnd()
value[3];
char repl[3],
nulls[3];
Buffer b;
bool isnull;
notifyFrontEndPending = 0;
......@@ -585,11 +578,10 @@ Async_NotifyFrontEnd()
value[0] = value[1] = value[2] = (Datum) 0;
value[Anum_pg_listener_notify - 1] = Int32GetDatum(0);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
{
d = heap_getattr(lTuple, Anum_pg_listener_relname,
tdesc, &isnull);
rTuple = heap_modifytuple(lTuple, b, lRel, value, nulls, repl);
d = heap_getattr(lTuple, Anum_pg_listener_relname, tdesc, &isnull);
rTuple = heap_modifytuple(lTuple, lRel, value, nulls, repl);
heap_replace(lRel, &lTuple->t_ctid, rTuple);
/* notifying the front end */
......@@ -603,8 +595,9 @@ Async_NotifyFrontEnd()
}
else
elog(NOTICE, "Async_NotifyFrontEnd: no asynchronous notification to frontend on interactive sessions");
ReleaseBuffer(b);
}
heap_endscan(sRel);
heap_close(lRel);
CommitTransactionCommand();
}
......
......@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.27 1998/08/06 05:12:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.28 1998/08/19 02:01:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -128,7 +128,7 @@ cluster(char oldrelname[], char oldindexname[])
elog(ERROR, "cluster: unknown relation: \"%s\"",
oldrelname);
}
OIDOldHeap = OldHeap->rd_id;/* Get OID for the index scan */
OIDOldHeap = RelationGetRelid(OldHeap);/* Get OID for the index scan */
OldIndex = index_openr(oldindexname); /* Open old index relation */
if (!RelationIsValid(OldIndex))
......@@ -136,7 +136,7 @@ cluster(char oldrelname[], char oldindexname[])
elog(ERROR, "cluster: unknown index: \"%s\"",
oldindexname);
}
OIDOldIndex = OldIndex->rd_id; /* OID for the index scan */
OIDOldIndex = RelationGetRelid(OldIndex); /* OID for the index scan */
heap_close(OldHeap);
index_close(OldIndex);
......@@ -150,7 +150,7 @@ cluster(char oldrelname[], char oldindexname[])
* with a pg_vlock.
*/
NewHeap = copy_heap(OIDOldHeap);
OIDNewHeap = NewHeap->rd_id;
OIDNewHeap = RelationGetRelid(NewHeap);
strcpy(NewHeapName, NewHeap->rd_rel->relname.data);
......@@ -257,7 +257,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
*/
Old_pg_index_Tuple =
SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(OldIndex->rd_id),
ObjectIdGetDatum(RelationGetRelid(OldIndex)),
0, 0, 0);
Assert(Old_pg_index_Tuple);
......@@ -265,7 +265,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
Old_pg_index_relation_Tuple =
SearchSysCacheTuple(RELOID,
ObjectIdGetDatum(OldIndex->rd_id),
ObjectIdGetDatum(RelationGetRelid(OldIndex)),
0, 0, 0);
Assert(Old_pg_index_relation_Tuple);
......
This diff is collapsed.
......@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.52 1998/07/27 19:37:51 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.53 1998/08/19 02:01:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -257,9 +257,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
fwrite(&ntuples, sizeof(int32), 1, fp);
}
for (tuple = heap_getnext(scandesc, 0, NULL);
tuple != NULL;
tuple = heap_getnext(scandesc, 0, NULL))
while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0)))
{
if (oids && !binary)
......@@ -417,7 +415,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
if (rel->rd_rel->relhasindex)
{
GetIndexRelations(rel->rd_id, &n_indices, &index_rels);
GetIndexRelations(RelationGetRelid(rel), &n_indices, &index_rels);
if (n_indices > 0)
{
has_index = true;
......@@ -435,7 +433,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
itupdescArr[i] = RelationGetTupleDescriptor(index_rels[i]);
pgIndexTup =
SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(index_rels[i]->rd_id),
ObjectIdGetDatum(RelationGetRelid(index_rels[i])),
0, 0, 0);
Assert(pgIndexTup);
pgIndexP[i] = (IndexTupleForm) GETSTRUCT(pgIndexTup);
......@@ -758,7 +756,6 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
(AttrNumber *) &(pgIndexP[i]->indkey[0]),
tuple,
tupDesc,
InvalidBuffer,
idatum,
index_nulls,
finfoP[i]);
......@@ -833,7 +830,6 @@ GetTypeElement(Oid type)
ObjectIdGetDatum(type),
0, 0, 0);
if (HeapTupleIsValid(typeTuple))
return ((int) ((TypeTupleForm) GETSTRUCT(typeTuple))->typelem);
......@@ -913,9 +909,7 @@ GetIndexRelations(Oid main_relation_oid,
scan = head;
head->next = NULL;
for (tuple = heap_getnext(scandesc, 0, NULL);
tuple != NULL;
tuple = heap_getnext(scandesc, 0, NULL))
while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0)))
{
index_relation_oid =
......@@ -1168,10 +1162,9 @@ CountTuples(Relation relation)
scandesc = heap_beginscan(relation, 0, SnapshotNow, 0, NULL);
for (tuple = heap_getnext(scandesc, 0, NULL), i = 0;
tuple != NULL;
tuple = heap_getnext(scandesc, 0, NULL), i++)
;
i = 0;
while (HeapTupleIsValid(tuple = heap_getnext(scandesc, 0)))
i++;
heap_endscan(scandesc);
return (i);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -466,7 +466,7 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
}
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(tupdesc->attrs[fnumber - 1]->atttypid),
ObjectIdGetDatum(tupdesc->attrs[fnumber - 1]->atttypid),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple))
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment