heapattr functions now return a Datum, not char *.

This commit is contained in:
Bruce Momjian 1997-09-12 04:09:08 +00:00
parent 6e04b4b20f
commit 1ea01720d5
28 changed files with 177 additions and 188 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.24 1997/09/08 21:40:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.25 1997/09/12 04:07:06 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
@ -372,25 +372,25 @@ heap_sysattrbyval(AttrNumber attno)
* heap_getsysattr
* ----------------
*/
char *
Datum
heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
{
switch (attnum)
{
case SelfItemPointerAttributeNumber:
return ((char *) &tup->t_ctid);
return ((Datum) &tup->t_ctid);
case ObjectIdAttributeNumber:
return ((char *) (long) tup->t_oid);
return ((Datum) (long) tup->t_oid);
case MinTransactionIdAttributeNumber:
return ((char *) (long) tup->t_xmin);
return ((Datum) (long) tup->t_xmin);
case MinCommandIdAttributeNumber:
return ((char *) (long) tup->t_cmin);
return ((Datum) (long) tup->t_cmin);
case MaxTransactionIdAttributeNumber:
return ((char *) (long) tup->t_xmax);
return ((Datum) (long) tup->t_xmax);
case MaxCommandIdAttributeNumber:
return ((char *) (long) tup->t_cmax);
return ((Datum) (long) tup->t_cmax);
case ChainItemPointerAttributeNumber:
return ((char *) &tup->t_chain);
return ((Datum) &tup->t_chain);
case AnchorItemPointerAttributeNumber:
elog(WARN, "heap_getsysattr: t_anchor does not exist!");
break;
@ -409,7 +409,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
if (!AbsoluteTimeIsBackwardCompatiblyValid(tup->t_tmin) &&
TransactionIdDidCommit(tup->t_xmin))
tup->t_tmin = TransactionIdGetCommitTime(tup->t_xmin);
return ((char *) (long) tup->t_tmin);
return ((Datum) (long) tup->t_tmin);
case MaxAbsoluteTimeAttributeNumber:
if (!AbsoluteTimeIsBackwardCompatiblyReal(tup->t_tmax))
{
@ -418,9 +418,9 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
else
tup->t_tmax = CURRENT_ABSTIME;
}
return ((char *) (long) tup->t_tmax);
return ((Datum) (long) tup->t_tmax);
case VersionTypeAttributeNumber:
return ((char *) (long) tup->t_vtype);
return ((Datum) (long) tup->t_vtype);
default:
elog(WARN, "heap_getsysattr: undefined attnum %d", attnum);
}
@ -444,7 +444,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
* the same attribute descriptor will go much quicker. -cim 5/4/91
* ----------------
*/
char *
Datum
fastgetattr(HeapTuple tup,
int attnum,
TupleDesc tupleDesc,
@ -479,7 +479,7 @@ fastgetattr(HeapTuple tup,
attnum--;
if (att[attnum]->attcacheoff > 0)
{
return (char *)
return (Datum)
fetchatt(&(att[attnum]),
(char *) tup + tup->t_hoff + att[attnum]->attcacheoff);
}
@ -489,7 +489,7 @@ fastgetattr(HeapTuple tup,
/*
* first attribute is always at position zero
*/
return ((char *) fetchatt(&(att[0]), (char *) tup + tup->t_hoff));
return ((Datum) fetchatt(&(att[0]), (char *) tup + tup->t_hoff));
}
tp = (char *) tup + tup->t_hoff;
@ -543,13 +543,13 @@ fastgetattr(HeapTuple tup,
{
if (att[attnum]->attcacheoff > 0)
{
return (char *)
return (Datum)
fetchatt(&(att[attnum]),
tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
{
return (char *)
return (Datum)
fetchatt(&(att[0]), (char *) tup + tup->t_hoff);
}
else if (!HeapTupleAllFixed(tup))
@ -618,7 +618,7 @@ fastgetattr(HeapTuple tup,
}
return
(char *) fetchatt(&(att[attnum]), tp + att[attnum]->attcacheoff);
(Datum) fetchatt(&(att[attnum]), tp + att[attnum]->attcacheoff);
}
else
{
@ -729,7 +729,7 @@ fastgetattr(HeapTuple tup,
off = LONGALIGN(off);
break;
}
return ((char *) fetchatt(&(att[attnum]), tp + off));
return ((Datum) fetchatt(&(att[attnum]), tp + off));
}
}
@ -782,11 +782,11 @@ heap_deformtuple(HeapTuple tuple,
{
bool isnull;
values[i] = (Datum) heap_getattr(tuple,
InvalidBuffer,
i + 1,
tdesc,
&isnull);
values[i] = heap_getattr(tuple,
InvalidBuffer,
i + 1,
tdesc,
&isnull);
if (isnull)
nulls[i] = 'n';
else
@ -936,15 +936,12 @@ heap_modifytuple(HeapTuple tuple,
if (repl[attoff] == ' ')
{
char *attr;
attr =
value[attoff] =
heap_getattr(tuple,
InvalidBuffer,
AttrOffsetGetAttrNumber(attoff),
RelationGetTupleDescriptor(relation),
&isNull);
value[attoff] = PointerGetDatum(attr);
nulls[attoff] = (isNull) ? 'n' : ' ';
}

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.18 1997/09/08 02:19:51 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.19 1997/09/12 04:07:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -42,10 +42,10 @@ heap_keytest(HeapTuple t,
for (; nkeys--; keys++)
{
atp = (Datum) heap_getattr(t, InvalidBuffer,
keys->sk_attno,
tupdesc,
&isnull);
atp = heap_getattr(t, InvalidBuffer,
keys->sk_attno,
tupdesc,
&isnull);
if (isnull)
/* XXX eventually should check if SK_ISNULL */

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.17 1997/09/08 02:19:56 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.18 1997/09/12 04:07:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -76,8 +76,8 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
int i,
j,
k;
char *outputstr,
*attr;
char *outputstr;
Datum attr;
bool isnull;
Oid typoutput;
@ -176,8 +176,8 @@ void
debugtup(HeapTuple tuple, TupleDesc typeinfo)
{
register int i;
char *attr,
*value;
Datum attr;
char *value;
bool isnull;
Oid typoutput;
@ -212,7 +212,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
int i,
j,
k;
char *attr;
Datum attr;
bool isnull;
/* ----------------
@ -308,9 +308,10 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
else
{
pq_putint(len, sizeof(int32));
pq_putnchar(attr, len);
pq_putnchar(DatumGetPointer(attr), len);
#ifdef IPORTAL_DEBUG
fprintf(stderr, "byref length %d data %x\n", len, attr);
fprintf(stderr, "byref length %d data %x\n", len,
DatumGetPointer(attr));
#endif
}
}

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.16 1997/09/08 21:41:06 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.17 1997/09/12 04:07:15 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
@ -385,11 +385,11 @@ GetIndexValue(HeapTuple tuple,
for (i = 0; i < FIgetnArgs(fInfo); i++)
{
attData[i] = (Datum) heap_getattr(tuple,
buffer,
attrNums[i],
hTupDesc,
attNull);
attData[i] = heap_getattr(tuple,
buffer,
attrNums[i],
hTupDesc,
attNull);
}
returnVal = (Datum) fmgr_array_args(FIgetProcOid(fInfo),
FIgetnArgs(fInfo),
@ -400,8 +400,8 @@ GetIndexValue(HeapTuple tuple,
}
else
{
returnVal = (Datum) heap_getattr(tuple, buffer, attrNums[attOff],
hTupDesc, attNull);
returnVal = heap_getattr(tuple, buffer, attrNums[attOff],
hTupDesc, attNull);
}
return returnVal;
}

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.19 1997/09/08 02:21:54 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.20 1997/09/12 04:07:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -216,8 +216,8 @@ Async_Notify(char *relname)
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
{
d = (Datum) heap_getattr(lTuple, b, Anum_pg_listener_notify,
tdesc, &isnull);
d = heap_getattr(lTuple, b, Anum_pg_listener_notify,
tdesc, &isnull);
if (!DatumGetInt32(d))
{
rTuple = heap_modifytuple(lTuple, b, lRel, value, nulls, repl);
@ -293,13 +293,13 @@ Async_NotifyAtCommit()
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
{
d = (Datum) heap_getattr(lTuple, b, Anum_pg_listener_relname,
tdesc, &isnull);
d = heap_getattr(lTuple, b, Anum_pg_listener_relname,
tdesc, &isnull);
if (AsyncExistsPendingNotify((char *) DatumGetPointer(d)))
{
d = (Datum) heap_getattr(lTuple, b, Anum_pg_listener_pid,
tdesc, &isnull);
d = heap_getattr(lTuple, b, Anum_pg_listener_pid,
tdesc, &isnull);
if (ourpid == DatumGetInt32(d))
{
@ -444,12 +444,12 @@ Async_Listen(char *relname, int pid)
s = heap_beginscan(lDesc, 0, NowTimeQual, 0, (ScanKey) NULL);
while (HeapTupleIsValid(htup = heap_getnext(s, 0, &b)))
{
d = (Datum) heap_getattr(htup, b, Anum_pg_listener_relname, tdesc,
&isnull);
d = heap_getattr(htup, b, Anum_pg_listener_relname, tdesc,
&isnull);
relnamei = DatumGetPointer(d);
if (!strncmp(relnamei, relname, NAMEDATALEN))
{
d = (Datum) heap_getattr(htup, b, Anum_pg_listener_pid, tdesc, &isnull);
d = heap_getattr(htup, b, Anum_pg_listener_pid, tdesc, &isnull);
pid = DatumGetInt32(d);
if (pid == ourPid)
{
@ -609,8 +609,8 @@ Async_NotifyFrontEnd()
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
{
d = (Datum) heap_getattr(lTuple, b, Anum_pg_listener_relname,
tdesc, &isnull);
d = heap_getattr(lTuple, b, Anum_pg_listener_relname,
tdesc, &isnull);
rTuple = heap_modifytuple(lTuple, b, lRel, value, nulls, repl);
heap_replace(lRel, &lTuple->t_ctid, rTuple);

View File

@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.33 1997/09/08 21:42:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.34 1997/09/12 04:07:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -270,8 +270,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
for (i = 0; i < attr_count; i++)
{
value = (Datum)
heap_getattr(tuple, InvalidBuffer, i + 1, tupDesc, &isnull);
value = heap_getattr(tuple, InvalidBuffer, i + 1, tupDesc, &isnull);
if (!binary)
{
if (!isnull)

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.46 1997/09/08 21:42:48 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.47 1997/09/12 04:07:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -308,8 +308,7 @@ vc_getrels(NameData *VacRelP)
* Berkeley.
*/
d = (Datum) heap_getattr(pgctup, buf, Anum_pg_class_relname,
pgcdesc, &n);
d = heap_getattr(pgctup, buf, Anum_pg_class_relname, pgcdesc, &n);
rname = (char *) d;
/* skip archive relations */
@ -334,8 +333,7 @@ vc_getrels(NameData *VacRelP)
continue;
}
d = (Datum) heap_getattr(pgctup, buf, Anum_pg_class_relsmgr,
pgcdesc, &n);
d = heap_getattr(pgctup, buf, Anum_pg_class_relsmgr, pgcdesc, &n);
smgrno = DatumGetInt16(d);
/* skip write-once storage managers */
@ -345,8 +343,7 @@ vc_getrels(NameData *VacRelP)
continue;
}
d = (Datum) heap_getattr(pgctup, buf, Anum_pg_class_relkind,
pgcdesc, &n);
d = heap_getattr(pgctup, buf, Anum_pg_class_relkind, pgcdesc, &n);
rkind = DatumGetChar(d);
@ -1714,8 +1711,8 @@ vc_attrstats(Relation onerel, VRelStats *vacrelstats, HeapTuple htup)
VacAttrStats *stats = &vacattrstats[i];
bool value_hit = true;
value = (Datum) heap_getattr(htup, InvalidBuffer,
stats->attr->attnum, tupDesc, &isnull);
value = heap_getattr(htup, InvalidBuffer,
stats->attr->attnum, tupDesc, &isnull);
if (!VacAttrStatsEqValid(stats))
continue;
@ -2289,8 +2286,8 @@ vc_getindices(Oid relid, int *nindices, Relation **Irel)
while (HeapTupleIsValid(pgitup = heap_getnext(pgiscan, 0, NULL)))
{
d = (Datum) heap_getattr(pgitup, InvalidBuffer, Anum_pg_index_indexrelid,
pgidesc, &n);
d = heap_getattr(pgitup, InvalidBuffer, Anum_pg_index_indexrelid,
pgidesc, &n);
i++;
if (i % 10 == 0)
ioid = (Oid *) repalloc(ioid, (i + 10) * sizeof(Oid));

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.8 1997/09/08 21:42:56 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.9 1997/09/12 04:07:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -315,8 +315,7 @@ ExecGetJunkAttribute(JunkFilter *junkfilter,
tuple = slot->val;
tupType = (TupleDesc) junkfilter->jf_tupType;
*value = (Datum)
heap_getattr(tuple, InvalidBuffer, resno, tupType, isNull);
*value = heap_getattr(tuple, InvalidBuffer, resno, tupType, isNull);
return true;
}
@ -391,10 +390,8 @@ ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
*/
for (i = 0; i < cleanLength; i++)
{
Datum d = (Datum)
heap_getattr(tuple, InvalidBuffer, cleanMap[i], tupType, &isNull);
values[i] = d;
values[i] =
heap_getattr(tuple, InvalidBuffer, cleanMap[i], tupType, &isNull);
if (isNull)
nulls[i] = 'n';

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.16 1997/09/08 21:43:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.17 1997/09/12 04:07:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -305,12 +305,11 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
return (Datum) tempSlot;
}
result = (Datum)
heap_getattr(heapTuple, /* tuple containing attribute */
buffer, /* buffer associated with tuple */
attnum, /* attribute number of desired attribute */
tuple_type,/* tuple descriptor of tuple */
isNull); /* return: is attribute null? */
result = heap_getattr(heapTuple, /* tuple containing attribute */
buffer, /* buffer associated with tuple */
attnum, /* attribute number of desired attribute */
tuple_type,/* tuple descriptor of tuple */
isNull); /* return: is attribute null? */
/* ----------------
* return null if att is null
@ -530,12 +529,11 @@ GetAttributeByNum(TupleTableSlot *slot,
return (char *) NULL;
}
retval = (Datum)
heap_getattr(slot->val,
slot->ttc_buffer,
attrno,
slot->ttc_tupleDescriptor,
isNull);
retval = heap_getattr(slot->val,
slot->ttc_buffer,
attrno,
slot->ttc_tupleDescriptor,
isNull);
if (*isNull)
return (char *) NULL;
return (char *) retval;
@ -595,12 +593,11 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
if (attrno == InvalidAttrNumber)
elog(WARN, "GetAttributeByName: attribute %s not found", attname);
retval = (Datum)
heap_getattr(slot->val,
slot->ttc_buffer,
attrno,
tupdesc,
isNull);
retval = heap_getattr(slot->val,
slot->ttc_buffer,
attrno,
tupdesc,
isNull);
if (*isNull)
return (char *) NULL;
return (char *) retval;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.10 1997/09/08 21:43:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.11 1997/09/12 04:07:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -83,11 +83,7 @@ ProjectAttribute(TupleDesc TD,
AttrNumber attrno = attrVar->varattno;
val = PointerGetDatum(heap_getattr(tup,
InvalidBuffer,
attrno,
TD,
isnullP));
val = heap_getattr(tup, InvalidBuffer, attrno, TD, isnullP);
if (*isnullP)
return (Datum) NULL;

View File

@ -638,7 +638,7 @@ aggGetAttr(TupleTableSlot *slot,
return (Datum) tempSlot;
}
result = (Datum)
result =
heap_getattr(heapTuple, /* tuple containing attribute */
buffer, /* buffer associated with tuple */
attnum, /* attribute number of desired attribute */

View File

@ -13,7 +13,7 @@
* columns. (ie. tuples from the same group are consecutive)
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.9 1997/09/08 21:43:10 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.10 1997/09/12 04:07:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -388,8 +388,8 @@ sameGroup(TupleTableSlot *oldslot,
{
bool isNull1,
isNull2;
char *attr1,
*attr2;
Datum attr1,
attr2;
char *val1,
*val2;
int i;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.10 1997/09/08 21:43:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.11 1997/09/12 04:07:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -182,8 +182,8 @@ ExecUnique(Unique *node)
*/
bool isNull1,
isNull2;
char *attr1,
*attr2;
Datum attr1,
attr2;
char *val1,
*val2;

View File

@ -319,7 +319,7 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
char *
SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
{
char *val;
Datum val;
bool isnull;
Oid foutoid;
@ -346,10 +346,10 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
return (fmgr(foutoid, val, gettypelem(tupdesc->attrs[fnumber - 1]->atttypid)));
}
char *
Datum
SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
{
char *val;
Datum val;
*isnull = true;
SPI_result = 0;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.8 1997/09/08 21:43:39 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.9 1997/09/12 04:07:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -213,7 +213,7 @@ void
be_printtup(HeapTuple tuple, TupleDesc typeinfo)
{
int i;
char *attr;
Datum attr;
bool isnull;
Oid typoutput;

View File

@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.25 1997/09/08 21:46:04 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.26 1997/09/12 04:07:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -1378,8 +1378,8 @@ findsupers(Oid relid, Oid **supervec)
{
qentry = (SuperQE *) palloc(sizeof(SuperQE));
d = (Datum) fastgetattr(inhtup, Anum_pg_inherits_inhparent,
inhtupdesc, &isNull);
d = fastgetattr(inhtup, Anum_pg_inherits_inhparent,
inhtupdesc, &isNull);
qentry->sqe_relid = DatumGetObjectId(d);
/* put this one on the queue */

View File

@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.25 1997/09/08 21:46:12 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.26 1997/09/12 04:08:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -230,7 +230,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen)
case T_Integer:
const_string = (char *) palloc(256);
string_palloced = true;
sprintf(const_string, "%d", expr->val.ival);
sprintf(const_string, "%ld", expr->val.ival);
break;
default:
elog(WARN,
@ -405,7 +405,7 @@ parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
case CASHOID: /* money */
const_string = (char *) palloc(256);
string_palloced = true;
sprintf(const_string, "%d",
sprintf(const_string, "%ld",
(long) ((Const *) expr)->constvalue);
break;
case TEXTOID: /* text */

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.4 1997/09/08 02:28:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.5 1997/09/12 04:08:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -109,11 +109,11 @@ RemoveRewriteRule(char *ruleName)
*/
ruleId = tuple->t_oid;
eventRelationOidDatum =
PointerGetDatum(heap_getattr(tuple,
buffer,
Anum_pg_rewrite_ev_class,
RelationGetTupleDescriptor(RewriteRelation),
&isNull));
heap_getattr(tuple,
buffer,
Anum_pg_rewrite_ev_class,
RelationGetTupleDescriptor(RewriteRelation),
&isNull);
if (isNull)
{
/* XXX strange!!! */

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.9 1997/09/08 21:46:44 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.10 1997/09/12 04:08:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -58,14 +58,14 @@ RuleIdGetActionInfo(Oid ruleoid, bool *instead_flag, Query **parseTrees)
if (ruletuple == NULL)
elog(WARN, "rule %u isn't in rewrite system relation", ruleoid);
ruleaction = heap_getattr(ruletuple,
InvalidBuffer,
Anum_pg_rewrite_action,
ruleTupdesc,
&action_is_null);
rule_evqual_string = heap_getattr(ruletuple, InvalidBuffer,
Anum_pg_rewrite_ev_qual,
ruleTupdesc, &action_is_null);
ruleaction = (char *)heap_getattr(ruletuple,
InvalidBuffer,
Anum_pg_rewrite_action,
ruleTupdesc,
&action_is_null);
rule_evqual_string = (char *)heap_getattr(ruletuple, InvalidBuffer,
Anum_pg_rewrite_ev_qual,
ruleTupdesc, &action_is_null);
*instead_flag = !!heap_getattr(ruletuple, InvalidBuffer,
Anum_pg_rewrite_is_instead,
ruleTupdesc, &instead_is_null);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.17 1997/09/08 21:47:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.18 1997/09/12 04:08:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -472,7 +472,7 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
}
/* copy the data from this block into the buffer */
d = (Datum) heap_getattr(htup, b, 2, obj_desc->hdesc, &isNull);
d = heap_getattr(htup, b, 2, obj_desc->hdesc, &isNull);
fsblock = (struct varlena *) DatumGetPointer(d);
off = obj_desc->offset - obj_desc->lowbyte;
@ -648,9 +648,9 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP)
* return the tuple.
*/
d = (Datum) heap_getattr(htup, *bufP, 1, obj_desc->hdesc, &isNull);
d = heap_getattr(htup, *bufP, 1, obj_desc->hdesc, &isNull);
lastbyte = (int32) DatumGetInt32(d);
d = (Datum) heap_getattr(htup, *bufP, 2, obj_desc->hdesc, &isNull);
d = heap_getattr(htup, *bufP, 2, obj_desc->hdesc, &isNull);
fsblock = (struct varlena *) DatumGetPointer(d);
/*
@ -817,7 +817,7 @@ inv_wrold(LargeObjectDesc *obj_desc,
newpage = BufferGetPage(newbuf);
hr = obj_desc->heap_r;
freespc = IFREESPC(page);
d = (Datum) heap_getattr(htup, buffer, 2, obj_desc->hdesc, &isNull);
d = heap_getattr(htup, buffer, 2, obj_desc->hdesc, &isNull);
fsblock = (struct varlena *) DatumGetPointer(d);
tupbytes = fsblock->vl_len - sizeof(fsblock->vl_len);
@ -1218,7 +1218,7 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln)
index_endscan(iscan);
/* get olastbyte attribute */
d = (Datum) heap_getattr(htup, buf, 1, hdesc, &isNull);
d = heap_getattr(htup, buf, 1, hdesc, &isNull);
size = DatumGetInt32(d) + 1;
/* wei hates it if you forget to do this */

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.5 1997/09/08 02:30:52 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.6 1997/09/12 04:08:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -82,11 +82,11 @@ int4notin(int16 not_in_arg, char *relation_and_attr)
current_tuple != NULL && retval;
current_tuple = heap_getnext(scan_descriptor, 0, NULL))
{
value = PointerGetDatum(heap_getattr(current_tuple,
InvalidBuffer,
(AttrNumber) attrid,
RelationGetTupleDescriptor(relation_to_scan),
&dummy));
value = heap_getattr(current_tuple,
InvalidBuffer,
(AttrNumber) attrid,
RelationGetTupleDescriptor(relation_to_scan),
&dummy);
integer_value = DatumGetInt16(value);
if (left_side_argument == integer_value)

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.13 1997/09/08 21:48:45 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.14 1997/09/12 04:08:28 momjian Exp $
*
* Notes:
* XXX This needs to use exception.h to handle recovery when
@ -387,40 +387,40 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
cacheInOutP->cc_skey[3].sk_argument =
(cacheInOutP->cc_key[3] == ObjectIdAttributeNumber)
? (Datum) tuple->t_oid
: (Datum) fastgetattr(tuple,
cacheInOutP->cc_key[3],
RelationGetTupleDescriptor(relation),
&isNull);
: fastgetattr(tuple,
cacheInOutP->cc_key[3],
RelationGetTupleDescriptor(relation),
&isNull);
Assert(!isNull);
/* FALLTHROUGH */
case 3:
cacheInOutP->cc_skey[2].sk_argument =
(cacheInOutP->cc_key[2] == ObjectIdAttributeNumber)
? (Datum) tuple->t_oid
: (Datum) fastgetattr(tuple,
cacheInOutP->cc_key[2],
RelationGetTupleDescriptor(relation),
&isNull);
: fastgetattr(tuple,
cacheInOutP->cc_key[2],
RelationGetTupleDescriptor(relation),
&isNull);
Assert(!isNull);
/* FALLTHROUGH */
case 2:
cacheInOutP->cc_skey[1].sk_argument =
(cacheInOutP->cc_key[1] == ObjectIdAttributeNumber)
? (Datum) tuple->t_oid
: (Datum) fastgetattr(tuple,
cacheInOutP->cc_key[1],
RelationGetTupleDescriptor(relation),
&isNull);
: fastgetattr(tuple,
cacheInOutP->cc_key[1],
RelationGetTupleDescriptor(relation),
&isNull);
Assert(!isNull);
/* FALLTHROUGH */
case 1:
cacheInOutP->cc_skey[0].sk_argument =
(cacheInOutP->cc_key[0] == ObjectIdAttributeNumber)
? (Datum) tuple->t_oid
: (Datum) fastgetattr(tuple,
cacheInOutP->cc_key[0],
RelationGetTupleDescriptor(relation),
&isNull);
: fastgetattr(tuple,
cacheInOutP->cc_key[0],
RelationGetTupleDescriptor(relation),
&isNull);
Assert(!isNull);
break;
default:

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.7 1997/09/08 21:48:56 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.8 1997/09/12 04:08:35 momjian Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@ -494,7 +494,7 @@ SearchSysCacheGetAttribute(int cacheId,
int32 attributeLength,
attributeByValue;
bool isNull;
char *attributeValue;
Datum attributeValue;
void *returnValue;
tp = SearchSysCacheTuple(cacheId, key1, key2, key3, key4);
@ -562,7 +562,7 @@ SearchSysCacheGetAttribute(int cacheId,
: attributeLength; /* fixed length */
tmp = (char *) palloc(size);
memmove(tmp, attributeValue, size);
memmove(tmp, (void *)attributeValue, size);
returnValue = (void *) tmp;
}

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.11 1997/09/08 02:31:34 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.12 1997/09/12 04:08:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -53,9 +53,9 @@ fmgr_dynamic(Oid procedureId, int *pronargs)
{
HeapTuple procedureTuple;
Form_pg_proc procedureStruct;
char *proname;
char *probinattr,
char *proname,
*probinstring;
Datum probinattr;
func_ptr user_fn;
Relation rdesc;
bool isnull;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.7 1997/09/08 02:32:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.8 1997/09/12 04:08:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -197,8 +197,8 @@ puttuple(struct leftist ** treep,
int
tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context)
{
register char *lattr,
*rattr;
register Datum lattr,
rattr;
int nkey = 0;
int result = 0;
bool isnull;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.7 1997/09/08 21:49:37 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.8 1997/09/12 04:08:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -32,9 +32,11 @@ static AbsoluteTime TimeQualGetStartTime(TimeQual qual);
static bool TimeQualIncludesNow(TimeQual qual);
static bool TimeQualIndicatesDisableValidityChecking(TimeQual qual);
static bool TimeQualIsLegal(TimeQual qual);
#ifndef NO_ASSERT_CHECKING
static bool TimeQualIsRanged(TimeQual qual);
static bool TimeQualIsSnapshot(TimeQual qual);
static bool TimeQualIsValid(TimeQual qual);
#endif
static bool TimeQualIsSnapshot(TimeQual qual);
/*
* TimeQualMode --
@ -133,6 +135,7 @@ HeapTupleSatisfiesUpperUnboundedInternalTimeQual(HeapTuple tuple,
* TimeQualIsValid --
* True iff time qualification is valid.
*/
#ifndef NO_ASSERT_CHECKING
static bool
TimeQualIsValid(TimeQual qual)
{
@ -179,6 +182,7 @@ TimeQualIsValid(TimeQual qual)
}
return (true);
}
#endif
/*
* TimeQualIsLegal --
@ -332,6 +336,7 @@ TimeQualIsSnapshot(TimeQual qual)
* Note:
* Assumes time qualification is valid.
*/
#ifndef NO_ASSERT_CHECKING
static bool
TimeQualIsRanged(TimeQual qual)
{
@ -344,6 +349,7 @@ TimeQualIsRanged(TimeQual qual)
return ((bool) !(((InternalTimeQual) qual)->mode & TimeQualAt));
}
#endif
/*
* TimeQualIndicatesDisableValidityChecking --

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: heapam.h,v 1.15 1997/09/08 21:50:45 momjian Exp $
* $Id: heapam.h,v 1.16 1997/09/12 04:09:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -97,11 +97,11 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
#define heap_getattr(tup, b, attnum, tupleDesc, isnull) \
(AssertMacro((tup) != NULL) ? \
((attnum) > (int) (tup)->t_natts) ? \
(((isnull) ? (*(isnull) = true) : (char)NULL), (char *)NULL) : \
(((isnull) ? (*(isnull) = true) : (char)NULL), (Datum)NULL) : \
((attnum) > 0) ? \
fastgetattr((tup), (attnum), (tupleDesc), (isnull)) : \
(((isnull) ? (*(isnull) = false) : (char)NULL), heap_getsysattr((tup), (b), (attnum))) : \
(char *)NULL)
(Datum)NULL)
extern HeapAccessStatistics heap_access_stats; /* in stats.c */
@ -143,10 +143,9 @@ DataFill(char *data, TupleDesc tupleDesc,
extern int heap_attisnull(HeapTuple tup, int attnum);
extern int heap_sysattrlen(AttrNumber attno);
extern bool heap_sysattrbyval(AttrNumber attno);
extern char *heap_getsysattr(HeapTuple tup, Buffer b, int attnum);
extern char *
fastgetattr(HeapTuple tup, int attnum,
TupleDesc att, bool *isnull);
extern Datum heap_getsysattr(HeapTuple tup, Buffer b, int attnum);
extern Datum fastgetattr(HeapTuple tup, int attnum,
TupleDesc att, bool *isnull);
extern HeapTuple heap_copytuple(HeapTuple tuple);
extern HeapTuple
heap_formtuple(TupleDesc tupleDescriptor,

View File

@ -80,7 +80,7 @@ extern void *SPI_saveplan(void *plan);
extern int SPI_fnumber(TupleDesc tupdesc, char *fname);
extern char *SPI_fname(TupleDesc tupdesc, int fnumber);
extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber);
extern char *SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull);
extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull);
extern char *SPI_gettype(TupleDesc tupdesc, int fnumber);
extern Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber);
extern char *SPI_getrelname(Relation rel);