mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +03:00
New HeapTuple structure/interface.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.32 1998/10/02 05:31:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.33 1998/11/27 19:52:22 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -41,8 +41,9 @@
|
||||
int32
|
||||
regprocin(char *pro_name_or_oid)
|
||||
{
|
||||
HeapTuple proctup = NULL;
|
||||
RegProcedure result = InvalidOid;
|
||||
HeapTuple proctup = NULL;
|
||||
HeapTupleData tuple;
|
||||
RegProcedure result = InvalidOid;
|
||||
|
||||
if (pro_name_or_oid == NULL)
|
||||
return InvalidOid;
|
||||
@@ -60,7 +61,7 @@ regprocin(char *pro_name_or_oid)
|
||||
ObjectIdGetDatum(oidin(pro_name_or_oid)),
|
||||
0, 0, 0);
|
||||
if (HeapTupleIsValid(proctup))
|
||||
result = (RegProcedure) proctup->t_oid;
|
||||
result = (RegProcedure) proctup->t_data->t_oid;
|
||||
else
|
||||
elog(ERROR, "No procedure with oid %s", pro_name_or_oid);
|
||||
}
|
||||
@@ -86,13 +87,14 @@ regprocin(char *pro_name_or_oid)
|
||||
sd = index_beginscan(idesc, false, 1, skey);
|
||||
while ((indexRes = index_getnext(sd, ForwardScanDirection)))
|
||||
{
|
||||
proctup = heap_fetch(hdesc, SnapshotNow,
|
||||
&indexRes->heap_iptr,
|
||||
tuple.t_self = indexRes->heap_iptr;
|
||||
heap_fetch(hdesc, SnapshotNow,
|
||||
&tuple,
|
||||
&buffer);
|
||||
pfree(indexRes);
|
||||
if (HeapTupleIsValid(proctup))
|
||||
if (tuple.t_data != NULL)
|
||||
{
|
||||
result = (RegProcedure) proctup->t_oid;
|
||||
result = (RegProcedure) tuple.t_data->t_oid;
|
||||
ReleaseBuffer(buffer);
|
||||
|
||||
if (++matches > 1)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.18 1998/09/01 04:32:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.19 1998/11/27 19:52:23 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -123,10 +123,10 @@ SetDefine(char *querystr, char *typename)
|
||||
repl);
|
||||
|
||||
setheapoverride(true);
|
||||
heap_replace(procrel, &tup->t_ctid, newtup);
|
||||
heap_replace(procrel, &tup->t_self, newtup);
|
||||
setheapoverride(false);
|
||||
|
||||
setoid = newtup->t_oid;
|
||||
setoid = newtup->t_data->t_oid;
|
||||
}
|
||||
else
|
||||
elog(ERROR, "setin: could not find new set oid tuple");
|
||||
|
||||
14
src/backend/utils/cache/catcache.c
vendored
14
src/backend/utils/cache/catcache.c
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.35 1998/10/12 00:53:33 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.36 1998/11/27 19:52:26 vadim Exp $
|
||||
*
|
||||
* Notes:
|
||||
* XXX This needs to use exception.h to handle recovery when
|
||||
@@ -386,7 +386,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
|
||||
case 4:
|
||||
cacheInOutP->cc_skey[3].sk_argument =
|
||||
(cacheInOutP->cc_key[3] == ObjectIdAttributeNumber)
|
||||
? (Datum) tuple->t_oid
|
||||
? (Datum) tuple->t_data->t_oid
|
||||
: fastgetattr(tuple,
|
||||
cacheInOutP->cc_key[3],
|
||||
RelationGetDescr(relation),
|
||||
@@ -396,7 +396,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
|
||||
case 3:
|
||||
cacheInOutP->cc_skey[2].sk_argument =
|
||||
(cacheInOutP->cc_key[2] == ObjectIdAttributeNumber)
|
||||
? (Datum) tuple->t_oid
|
||||
? (Datum) tuple->t_data->t_oid
|
||||
: fastgetattr(tuple,
|
||||
cacheInOutP->cc_key[2],
|
||||
RelationGetDescr(relation),
|
||||
@@ -406,7 +406,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
|
||||
case 2:
|
||||
cacheInOutP->cc_skey[1].sk_argument =
|
||||
(cacheInOutP->cc_key[1] == ObjectIdAttributeNumber)
|
||||
? (Datum) tuple->t_oid
|
||||
? (Datum) tuple->t_data->t_oid
|
||||
: fastgetattr(tuple,
|
||||
cacheInOutP->cc_key[1],
|
||||
RelationGetDescr(relation),
|
||||
@@ -416,7 +416,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
|
||||
case 1:
|
||||
cacheInOutP->cc_skey[0].sk_argument =
|
||||
(cacheInOutP->cc_key[0] == ObjectIdAttributeNumber)
|
||||
? (Datum) tuple->t_oid
|
||||
? (Datum) tuple->t_data->t_oid
|
||||
: fastgetattr(tuple,
|
||||
cacheInOutP->cc_key[0],
|
||||
RelationGetDescr(relation),
|
||||
@@ -513,7 +513,7 @@ CatalogCacheIdInvalidate(int cacheId, /* XXX */
|
||||
elt = DLGetSucc(elt))
|
||||
{
|
||||
ct = (CatCTup *) DLE_VAL(elt);
|
||||
if (ItemPointerEquals(pointer, &ct->ct_tup->t_ctid))
|
||||
if (ItemPointerEquals(pointer, &ct->ct_tup->t_self))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1141,7 +1141,7 @@ RelationInvalidateCatalogCacheTuple(Relation relation,
|
||||
|
||||
(*function) (ccp->id,
|
||||
CatalogCacheComputeTupleHashIndex(ccp, relation, tuple),
|
||||
&tuple->t_ctid);
|
||||
&tuple->t_self);
|
||||
|
||||
heap_close(relation);
|
||||
}
|
||||
|
||||
4
src/backend/utils/cache/fcache.c
vendored
4
src/backend/utils/cache/fcache.c
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.18 1998/09/01 04:32:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.19 1998/11/27 19:52:27 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -74,7 +74,7 @@ GetDynamicFuncArgType(Var *arg, ExprContext *econtext)
|
||||
elog(ERROR, "Lookup failed on type tuple for class %s",
|
||||
relname);
|
||||
|
||||
return tup->t_oid;
|
||||
return tup->t_data->t_oid;
|
||||
}
|
||||
|
||||
static FunctionCachePtr
|
||||
|
||||
14
src/backend/utils/cache/inval.c
vendored
14
src/backend/utils/cache/inval.c
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.17 1998/10/12 00:53:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.18 1998/11/27 19:52:28 vadim Exp $
|
||||
*
|
||||
* Note - this code is real crufty...
|
||||
*
|
||||
@@ -250,25 +250,25 @@ getmyrelids()
|
||||
PointerGetDatum(RelationRelationName),
|
||||
0, 0, 0);
|
||||
Assert(HeapTupleIsValid(tuple));
|
||||
MyRelationRelationId = tuple->t_oid;
|
||||
MyRelationRelationId = tuple->t_data->t_oid;
|
||||
|
||||
tuple = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(AttributeRelationName),
|
||||
0, 0, 0);
|
||||
Assert(HeapTupleIsValid(tuple));
|
||||
MyAttributeRelationId = tuple->t_oid;
|
||||
MyAttributeRelationId = tuple->t_data->t_oid;
|
||||
|
||||
tuple = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(AccessMethodRelationName),
|
||||
0, 0, 0);
|
||||
Assert(HeapTupleIsValid(tuple));
|
||||
MyAMRelationId = tuple->t_oid;
|
||||
MyAMRelationId = tuple->t_data->t_oid;
|
||||
|
||||
tuple = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(AccessMethodOperatorRelationName),
|
||||
0, 0, 0);
|
||||
Assert(HeapTupleIsValid(tuple));
|
||||
MyAMOPRelationId = tuple->t_oid;
|
||||
MyAMOPRelationId = tuple->t_data->t_oid;
|
||||
}
|
||||
|
||||
/* --------------------------------
|
||||
@@ -481,11 +481,11 @@ RelationInvalidateRelationCache(Relation relation,
|
||||
* ----------------
|
||||
*/
|
||||
if (relationId == MyRelationRelationId)
|
||||
objectId = tuple->t_oid;
|
||||
objectId = tuple->t_data->t_oid;
|
||||
else if (relationId == MyAttributeRelationId)
|
||||
objectId = ((Form_pg_attribute) GETSTRUCT(tuple))->attrelid;
|
||||
else if (relationId == MyAMRelationId)
|
||||
objectId = tuple->t_oid;
|
||||
objectId = tuple->t_data->t_oid;
|
||||
else if (relationId == MyAMOPRelationId)
|
||||
{
|
||||
; /* objectId is unused */
|
||||
|
||||
45
src/backend/utils/cache/relcache.c
vendored
45
src/backend/utils/cache/relcache.c
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.50 1998/09/01 04:33:02 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.51 1998/11/27 19:52:28 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -383,10 +383,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
|
||||
* this bug is discovered and killed by wei on 9/27/91.
|
||||
* -------------------
|
||||
*/
|
||||
return_tuple = (HeapTuple) palloc((Size) pg_class_tuple->t_len);
|
||||
memmove((char *) return_tuple,
|
||||
(char *) pg_class_tuple,
|
||||
(int) pg_class_tuple->t_len);
|
||||
return_tuple = heap_copytuple(pg_class_tuple);
|
||||
}
|
||||
|
||||
/* all done */
|
||||
@@ -718,7 +715,7 @@ RelationBuildRuleLock(Relation relation)
|
||||
|
||||
rule = (RewriteRule *) palloc(sizeof(RewriteRule));
|
||||
|
||||
rule->ruleId = pg_rewrite_tuple->t_oid;
|
||||
rule->ruleId = pg_rewrite_tuple->t_data->t_oid;
|
||||
|
||||
rule->event =
|
||||
(int) heap_getattr(pg_rewrite_tuple,
|
||||
@@ -838,7 +835,7 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo)
|
||||
* get information from the pg_class_tuple
|
||||
* ----------------
|
||||
*/
|
||||
relid = pg_class_tuple->t_oid;
|
||||
relid = pg_class_tuple->t_data->t_oid;
|
||||
relp = (Form_pg_class) GETSTRUCT(pg_class_tuple);
|
||||
natts = relp->relnatts;
|
||||
|
||||
@@ -1661,11 +1658,10 @@ AttrDefaultFetch(Relation relation)
|
||||
Relation adrel;
|
||||
Relation irel;
|
||||
ScanKeyData skey;
|
||||
HeapTuple tuple;
|
||||
HeapTupleData tuple;
|
||||
Form_pg_attrdef adform;
|
||||
IndexScanDesc sd;
|
||||
RetrieveIndexResult indexRes;
|
||||
ItemPointer iptr;
|
||||
struct varlena *val;
|
||||
bool isnull;
|
||||
int found;
|
||||
@@ -1680,7 +1676,7 @@ AttrDefaultFetch(Relation relation)
|
||||
adrel = heap_openr(AttrDefaultRelationName);
|
||||
irel = index_openr(AttrDefaultIndex);
|
||||
sd = index_beginscan(irel, false, 1, &skey);
|
||||
tuple = (HeapTuple) NULL;
|
||||
tuple.t_data = NULL;
|
||||
|
||||
for (found = 0;;)
|
||||
{
|
||||
@@ -1690,13 +1686,13 @@ AttrDefaultFetch(Relation relation)
|
||||
if (!indexRes)
|
||||
break;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(adrel, SnapshotNow, iptr, &buffer);
|
||||
tuple.t_self = indexRes->heap_iptr;
|
||||
heap_fetch(adrel, SnapshotNow, &tuple, &buffer);
|
||||
pfree(indexRes);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
if (tuple.t_data == NULL)
|
||||
continue;
|
||||
found++;
|
||||
adform = (Form_pg_attrdef) GETSTRUCT(tuple);
|
||||
adform = (Form_pg_attrdef) GETSTRUCT(&tuple);
|
||||
for (i = 0; i < ndef; i++)
|
||||
{
|
||||
if (adform->adnum != attrdef[i].adnum)
|
||||
@@ -1706,7 +1702,7 @@ AttrDefaultFetch(Relation relation)
|
||||
relation->rd_att->attrs[adform->adnum - 1]->attname.data,
|
||||
relation->rd_rel->relname.data);
|
||||
|
||||
val = (struct varlena *) fastgetattr(tuple,
|
||||
val = (struct varlena *) fastgetattr(&tuple,
|
||||
Anum_pg_attrdef_adbin,
|
||||
adrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
@@ -1714,7 +1710,7 @@ AttrDefaultFetch(Relation relation)
|
||||
relation->rd_att->attrs[adform->adnum - 1]->attname.data,
|
||||
relation->rd_rel->relname.data);
|
||||
attrdef[i].adbin = textout(val);
|
||||
val = (struct varlena *) fastgetattr(tuple,
|
||||
val = (struct varlena *) fastgetattr(&tuple,
|
||||
Anum_pg_attrdef_adsrc,
|
||||
adrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
@@ -1750,10 +1746,9 @@ RelCheckFetch(Relation relation)
|
||||
Relation rcrel;
|
||||
Relation irel;
|
||||
ScanKeyData skey;
|
||||
HeapTuple tuple;
|
||||
HeapTupleData tuple;
|
||||
IndexScanDesc sd;
|
||||
RetrieveIndexResult indexRes;
|
||||
ItemPointer iptr;
|
||||
Name rcname;
|
||||
struct varlena *val;
|
||||
bool isnull;
|
||||
@@ -1768,7 +1763,7 @@ RelCheckFetch(Relation relation)
|
||||
rcrel = heap_openr(RelCheckRelationName);
|
||||
irel = index_openr(RelCheckIndex);
|
||||
sd = index_beginscan(irel, false, 1, &skey);
|
||||
tuple = (HeapTuple) NULL;
|
||||
tuple.t_data = NULL;
|
||||
|
||||
for (found = 0;;)
|
||||
{
|
||||
@@ -1778,30 +1773,30 @@ RelCheckFetch(Relation relation)
|
||||
if (!indexRes)
|
||||
break;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(rcrel, SnapshotNow, iptr, &buffer);
|
||||
tuple.t_self = indexRes->heap_iptr;
|
||||
heap_fetch(rcrel, SnapshotNow, &tuple, &buffer);
|
||||
pfree(indexRes);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
if (tuple.t_data == NULL)
|
||||
continue;
|
||||
if (found == ncheck)
|
||||
elog(ERROR, "RelCheckFetch: unexpected record found for rel %s",
|
||||
relation->rd_rel->relname.data);
|
||||
|
||||
rcname = (Name) fastgetattr(tuple,
|
||||
rcname = (Name) fastgetattr(&tuple,
|
||||
Anum_pg_relcheck_rcname,
|
||||
rcrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
elog(ERROR, "RelCheckFetch: rcname IS NULL for rel %s",
|
||||
relation->rd_rel->relname.data);
|
||||
check[found].ccname = nameout(rcname);
|
||||
val = (struct varlena *) fastgetattr(tuple,
|
||||
val = (struct varlena *) fastgetattr(&tuple,
|
||||
Anum_pg_relcheck_rcbin,
|
||||
rcrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
|
||||
relation->rd_rel->relname.data);
|
||||
check[found].ccbin = textout(val);
|
||||
val = (struct varlena *) fastgetattr(tuple,
|
||||
val = (struct varlena *) fastgetattr(&tuple,
|
||||
Anum_pg_relcheck_rcsrc,
|
||||
rcrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.20 1998/09/03 02:32:41 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.21 1998/11/27 19:52:29 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -188,7 +188,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
|
||||
int nbytes;
|
||||
int max,
|
||||
i;
|
||||
HeapTuple tup;
|
||||
HeapTupleData tup;
|
||||
Page pg;
|
||||
PageHeader ph;
|
||||
char *dbfname;
|
||||
@@ -238,7 +238,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
|
||||
|
||||
/* get a pointer to the tuple itself */
|
||||
offset = (int) ph->pd_linp[i].lp_off;
|
||||
tup = (HeapTuple) (((char *) pg) + offset);
|
||||
tup.t_data = (HeapTupleHeader) (((char *) pg) + offset);
|
||||
|
||||
/*
|
||||
* if the tuple has been deleted (the database was destroyed),
|
||||
@@ -253,7 +253,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
|
||||
* if data is ever moved and no longer the first field this
|
||||
* will be broken!! -mer 11 Nov 1991.
|
||||
*/
|
||||
if (TransactionIdIsValid((TransactionId) tup->t_xmax))
|
||||
if (TransactionIdIsValid((TransactionId) tup.t_data->t_xmax))
|
||||
continue;
|
||||
|
||||
/*
|
||||
@@ -267,7 +267,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
|
||||
* you exactly how big the header actually is. use the PC
|
||||
* means of getting at sys cat attrs.
|
||||
*/
|
||||
tup_db = (Form_pg_database) GETSTRUCT(tup);
|
||||
tup_db = (Form_pg_database) GETSTRUCT(&tup);
|
||||
#ifdef MULTIBYTE
|
||||
|
||||
/*
|
||||
@@ -279,7 +279,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
|
||||
#endif
|
||||
if (strcmp(name, tup_db->datname.data) == 0)
|
||||
{
|
||||
*db_id = tup->t_oid;
|
||||
*db_id = tup.t_data->t_oid;
|
||||
strncpy(path, VARDATA(&(tup_db->datpath)),
|
||||
(VARSIZE(&(tup_db->datpath)) - VARHDRSZ));
|
||||
*(path + VARSIZE(&(tup_db->datpath)) - VARHDRSZ) = '\0';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.42 1998/09/01 03:27:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.43 1998/11/27 19:52:32 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Sorts the first relation into the second relation.
|
||||
@@ -66,7 +66,6 @@ static void initialrun(Sort *node);
|
||||
static void inittapes(Sort *node);
|
||||
static void merge(Sort *node, struct tape * dest);
|
||||
static FILE *mergeruns(Sort *node);
|
||||
static HeapTuple tuplecopy(HeapTuple tup);
|
||||
static int _psort_cmp(HeapTuple *ltup, HeapTuple *rtup);
|
||||
|
||||
|
||||
@@ -224,9 +223,11 @@ inittapes(Sort *node)
|
||||
|
||||
#define PUTTUP(NODE, TUP, FP) \
|
||||
( \
|
||||
(TUP)->t_len += HEAPTUPLESIZE, \
|
||||
((Psortstate *)NODE->psortstate)->BytesWritten += (TUP)->t_len, \
|
||||
fwrite((char *)TUP, (TUP)->t_len, 1, FP), \
|
||||
fwrite((char *)&((TUP)->t_len), sizeof (tlendummy), 1, FP) \
|
||||
fwrite((char *)&((TUP)->t_len), sizeof (tlendummy), 1, FP), \
|
||||
(TUP)->t_len -= HEAPTUPLESIZE \
|
||||
)
|
||||
|
||||
#define ENDRUN(FP) fwrite((char *)&tlenzero, sizeof (tlenzero), 1, FP)
|
||||
@@ -237,10 +238,11 @@ inittapes(Sort *node)
|
||||
IncrProcessed(), \
|
||||
((Psortstate *)NODE->psortstate)->BytesRead += (LEN) - sizeof (tlenzero), \
|
||||
fread((char *)(TUP) + sizeof (tlenzero), (LEN) - sizeof (tlenzero), 1, FP), \
|
||||
(TUP)->t_data = (HeapTupleHeader) ((char *)(TUP) + HEAPTUPLESIZE), \
|
||||
fread((char *)&tlendummy, sizeof (tlendummy), 1, FP) \
|
||||
)
|
||||
|
||||
#define SETTUPLEN(TUP, LEN) (TUP)->t_len = LEN
|
||||
#define SETTUPLEN(TUP, LEN) (TUP)->t_len = LEN - HEAPTUPLESIZE
|
||||
|
||||
/*
|
||||
* USEMEM - record use of memory FREEMEM - record
|
||||
@@ -407,7 +409,7 @@ createfirstrun(Sort *node)
|
||||
break;
|
||||
}
|
||||
|
||||
tup = tuplecopy(cr_slot->val);
|
||||
tup = heap_copytuple(cr_slot->val);
|
||||
ExecClearTuple(cr_slot);
|
||||
|
||||
IncrProcessed();
|
||||
@@ -524,7 +526,7 @@ createrun(Sort *node, FILE *file)
|
||||
}
|
||||
else
|
||||
{
|
||||
tup = tuplecopy(cr_slot->val);
|
||||
tup = heap_copytuple(cr_slot->val);
|
||||
ExecClearTuple(cr_slot);
|
||||
PS(node)->tupcount++;
|
||||
}
|
||||
@@ -577,26 +579,6 @@ createrun(Sort *node, FILE *file)
|
||||
return !foundeor;
|
||||
}
|
||||
|
||||
/*
|
||||
* tuplecopy - see also tuple.c:palloctup()
|
||||
*
|
||||
* This should eventually go there under that name? And this will
|
||||
* then use palloc directly (see version -r1.2).
|
||||
*/
|
||||
static HeapTuple
|
||||
tuplecopy(HeapTuple tup)
|
||||
{
|
||||
HeapTuple rettup;
|
||||
|
||||
if (!HeapTupleIsValid(tup))
|
||||
{
|
||||
return NULL; /* just in case */
|
||||
}
|
||||
rettup = (HeapTuple) palloc(tup->t_len);
|
||||
memmove((char *) rettup, (char *) tup, tup->t_len); /* XXX */
|
||||
return rettup;
|
||||
}
|
||||
|
||||
/*
|
||||
* mergeruns - merges all runs from input tapes
|
||||
* (polyphase merge Alg.D(D6)--Knuth, Vol.3, p271)
|
||||
@@ -792,7 +774,7 @@ psort_grabtuple(Sort *node, bool *should_free)
|
||||
return NULL;
|
||||
if (GETLEN(tuplen, PS(node)->psort_grab_file) && tuplen != 0)
|
||||
{
|
||||
tup = (HeapTuple) palloc((unsigned) tuplen);
|
||||
tup = ALLOCTUP(tuplen);
|
||||
SETTUPLEN(tup, tuplen);
|
||||
GETTUP(node, tup, tuplen, PS(node)->psort_grab_file);
|
||||
|
||||
@@ -864,7 +846,7 @@ psort_grabtuple(Sort *node, bool *should_free)
|
||||
*/
|
||||
fseek(PS(node)->psort_grab_file,
|
||||
PS(node)->psort_current - tuplen, SEEK_SET);
|
||||
tup = (HeapTuple) palloc((unsigned) tuplen);
|
||||
tup = ALLOCTUP(tuplen);
|
||||
SETTUPLEN(tup, tuplen);
|
||||
GETTUP(node, tup, tuplen, PS(node)->psort_grab_file);
|
||||
return tup; /* file position is equal to psort_current */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.19 1998/09/01 04:33:41 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.20 1998/11/27 19:52:36 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -75,7 +75,7 @@ setheapoverride(bool on)
|
||||
* Xmax is not committed))) that has not been committed
|
||||
*/
|
||||
bool
|
||||
HeapTupleSatisfiesItself(HeapTuple tuple)
|
||||
HeapTupleSatisfiesItself(HeapTupleHeader tuple)
|
||||
{
|
||||
|
||||
if (!(tuple->t_infomask & HEAP_XMIN_COMMITTED))
|
||||
@@ -171,7 +171,7 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
|
||||
* that do catalog accesses. this is unfortunate, but not critical.
|
||||
*/
|
||||
bool
|
||||
HeapTupleSatisfiesNow(HeapTuple tuple)
|
||||
HeapTupleSatisfiesNow(HeapTupleHeader tuple)
|
||||
{
|
||||
if (AMI_OVERRIDE)
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user