*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.24 2000/01/26 05:55:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.25 2000/05/30 04:24:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
bool isNull;
Datum datum;
- int test;
+ Datum test;
IncrIndexProcessed();
if (key[0].sk_flags & SK_COMMUTE)
{
- test = (*(fmgr_faddr(&key[0].sk_func)))
- (DatumGetPointer(key[0].sk_argument),
- datum) ? 1 : 0;
+ test = FunctionCall2(&key[0].sk_func,
+ key[0].sk_argument, datum);
}
else
{
- test = (*(fmgr_faddr(&key[0].sk_func)))
- (datum,
- DatumGetPointer(key[0].sk_argument)) ? 1 : 0;
+ test = FunctionCall2(&key[0].sk_func,
+ datum, key[0].sk_argument);
}
- if (!test == !(key[0].sk_flags & SK_NEGATE))
+ if (DatumGetBool(test) == !!(key[0].sk_flags & SK_NEGATE))
return false;
scanKeySize -= 1;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.52 2000/01/26 05:55:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.53 2000/05/30 04:24:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
continue;
if (OidIsValid(thisState->typoutput))
{
- outputstr = (char *) (*fmgr_faddr(&thisState->finfo))
- (attr, thisState->typelem, typeinfo->attrs[i]->atttypmod);
+ outputstr = DatumGetCString(FunctionCall3(&thisState->finfo,
+ attr,
+ ObjectIdGetDatum(thisState->typelem),
+ Int32GetDatum(typeinfo->attrs[i]->atttypmod)));
pq_sendcountedtext(&buf, outputstr, strlen(outputstr));
pfree(outputstr);
}
if (getTypeOutAndElem((Oid) typeinfo->attrs[i]->atttypid,
&typoutput, &typelem))
{
- value = fmgr(typoutput, attr, typelem,
- typeinfo->attrs[i]->atttypmod);
+ value = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(typeinfo->attrs[i]->atttypmod)));
printatt((unsigned) i + 1, typeinfo->attrs[i], value);
pfree(value);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.54 2000/05/30 00:49:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.55 2000/05/30 04:24:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
ev1p = &((GISTENTRY *) VARDATA(evec))[1];
/* form union of decompressed entries */
- datum = (*fmgr_faddr(&giststate->unionFn)) (evec, &datumsize);
+ datum = (char *)
+ DatumGetPointer(FunctionCall2(&giststate->unionFn,
+ PointerGetDatum(evec),
+ PointerGetDatum(&datumsize)));
/* did union leave decompressed version of oldud unchanged? */
- (*fmgr_faddr(&giststate->equalFn)) (ev0p->pred, datum, &result);
+ FunctionCall3(&giststate->equalFn,
+ PointerGetDatum(ev0p->pred),
+ PointerGetDatum(datum),
+ PointerGetDatum(&result));
if (!result)
{
TupleDesc td = RelationGetDescr(r);
VARSIZE(entryvec) = (maxoff + 2) * sizeof(GISTENTRY) + VARHDRSZ;
/* now let the user-defined picksplit function set up the split vector */
- (*fmgr_faddr(&giststate->picksplitFn)) (entryvec, &v);
+ FunctionCall2(&giststate->picksplitFn,
+ PointerGetDatum(entryvec),
+ PointerGetDatum(&v));
/* compress ldatum and rdatum */
gistcentryinit(giststate, &tmpentry, v.spl_ldatum, (Relation) NULL,
size = IndexTupleSize(datum) - sizeof(IndexTupleData);
datum += sizeof(IndexTupleData);
gistdentryinit(giststate, &entry, datum, r, p, i, size, FALSE);
- (*fmgr_faddr(&giststate->penaltyFn)) (&entry, &identry, &usize);
+ FunctionCall3(&giststate->penaltyFn,
+ PointerGetDatum(&entry),
+ PointerGetDatum(&identry),
+ PointerGetDatum(&usize));
if (which_grow < 0 || usize < which_grow)
{
which = i;
gistentryinit(*e, pr, r, pg, o, b, l);
if (giststate->haskeytype)
{
- dep = (GISTENTRY *) ((*fmgr_faddr(&giststate->decompressFn)) (e));
+ dep = (GISTENTRY *)
+ DatumGetPointer(FunctionCall1(&giststate->decompressFn,
+ PointerGetDatum(e)));
gistentryinit(*e, dep->pred, dep->rel, dep->page, dep->offset, dep->bytes,
dep->leafkey);
if (dep != e)
gistentryinit(*e, pr, r, pg, o, b, l);
if (giststate->haskeytype)
{
- cep = (GISTENTRY *) ((*fmgr_faddr(&giststate->compressFn)) (e));
+ cep = (GISTENTRY *)
+ DatumGetPointer(FunctionCall1(&giststate->compressFn,
+ PointerGetDatum(e)));
gistentryinit(*e, cep->pred, cep->rel, cep->page, cep->offset, cep->bytes,
cep->leafkey);
if (cep != e)
{
bool isNull;
Datum datum;
- int test;
+ Datum test;
GISTENTRY de;
IncrIndexProcessed();
if (key[0].sk_flags & SK_COMMUTE)
{
- test = (*fmgr_faddr(&key[0].sk_func))
- (DatumGetPointer(key[0].sk_argument),
- &de, key[0].sk_procedure) ? 1 : 0;
+ test = FunctionCall3(&key[0].sk_func,
+ key[0].sk_argument,
+ PointerGetDatum(&de),
+ ObjectIdGetDatum(key[0].sk_procedure));
}
else
{
- test = (*fmgr_faddr(&key[0].sk_func))
- (&de,
- DatumGetPointer(key[0].sk_argument),
- key[0].sk_procedure) ? 1 : 0;
+ test = FunctionCall3(&key[0].sk_func,
+ PointerGetDatum(&de),
+ key[0].sk_argument,
+ ObjectIdGetDatum(key[0].sk_procedure));
}
- if (!test == !(key[0].sk_flags & SK_NEGATE))
+ if (DatumGetBool(test) == !!(key[0].sk_flags & SK_NEGATE))
return false;
scanKeySize -= 1;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.23 2000/01/26 05:55:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.24 2000/05/30 04:24:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
uint32 n;
Bucket bucket;
- RegProcedure proc;
- proc = metap->hashm_procid;
- n = (uint32) fmgr(proc, key);
+ n = DatumGetUInt32(OidFunctionCall1(metap->hashm_procid, key));
bucket = n & metap->hashm_highmask;
if (bucket > metap->hashm_maxbucket)
bucket = bucket & metap->hashm_lowmask;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.43 2000/05/28 17:55:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.44 2000/05/30 04:24:32 tgl Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
* ----------------
*/
specificResult = (InsertIndexResult)
- fmgr(procedure, relation, datum, nulls, heap_t_ctid, heapRel, NULL);
+ DatumGetPointer(OidFunctionCall6(procedure,
+ PointerGetDatum(relation),
+ PointerGetDatum(datum),
+ PointerGetDatum(nulls),
+ PointerGetDatum(heap_t_ctid),
+ PointerGetDatum(heapRel),
+ PointerGetDatum(NULL)));
/* must be pfree'ed */
return specificResult;
RELATION_CHECKS;
GET_REL_PROCEDURE(delete, amdelete);
- fmgr(procedure, relation, indexItem);
+ OidFunctionCall2(procedure,
+ PointerGetDatum(relation),
+ PointerGetDatum(indexItem));
}
/* ----------------
LockRelation(relation, AccessShareLock);
scandesc = (IndexScanDesc)
- fmgr(procedure, relation, scanFromEnd, numberOfKeys, key);
+ DatumGetPointer(OidFunctionCall4(procedure,
+ PointerGetDatum(relation),
+ BoolGetDatum(scanFromEnd),
+ UInt16GetDatum(numberOfKeys),
+ PointerGetDatum(key)));
return scandesc;
}
SCAN_CHECKS;
GET_SCAN_PROCEDURE(rescan, amrescan);
- fmgr(procedure, scan, scanFromEnd, key);
+ OidFunctionCall3(procedure,
+ PointerGetDatum(scan),
+ BoolGetDatum(scanFromEnd),
+ PointerGetDatum(key));
}
/* ----------------
SCAN_CHECKS;
GET_SCAN_PROCEDURE(endscan, amendscan);
- fmgr(procedure, scan);
+ OidFunctionCall1(procedure, PointerGetDatum(scan));
/* Release lock and refcount acquired by index_beginscan */
SCAN_CHECKS;
GET_SCAN_PROCEDURE(markpos, ammarkpos);
- fmgr(procedure, scan);
+ OidFunctionCall1(procedure, PointerGetDatum(scan));
}
/* ----------------
SCAN_CHECKS;
GET_SCAN_PROCEDURE(restrpos, amrestrpos);
- fmgr(procedure, scan);
+ OidFunctionCall1(procedure, PointerGetDatum(scan));
}
/* ----------------
* ----------------
*/
result = (RetrieveIndexResult)
- (*fmgr_faddr(&scan->fn_getnext)) (scan, direction);
+ DatumGetPointer(FunctionCall2(&scan->fn_getnext,
+ PointerGetDatum(scan),
+ Int32GetDatum(direction)));
return result;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.43 2000/05/28 17:55:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.44 2000/05/30 04:24:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Datum left,
Datum right)
{
+ bool result = false;
Index index;
- long tmpres = 0;
- bool result = 0;
StrategyOperator operator;
- ScanKey entry;
for (index = 0, operator = &term->operatorData[0];
index < term->degree; index += 1, operator += 1)
{
+ ScanKey entry;
entry = &map->entry[operator->strategy - 1];
switch (operator->flags ^ entry->sk_flags)
{
case 0x0:
- tmpres = (long) FMGR_PTR2(&entry->sk_func,
- left, right);
+ result = DatumGetBool(FunctionCall2(&entry->sk_func,
+ left, right));
break;
case SK_NEGATE:
- tmpres = (long) !FMGR_PTR2(&entry->sk_func,
- left, right);
+ result = ! DatumGetBool(FunctionCall2(&entry->sk_func,
+ left, right));
break;
case SK_COMMUTE:
- tmpres = (long) FMGR_PTR2(&entry->sk_func,
- right, left);
+ result = DatumGetBool(FunctionCall2(&entry->sk_func,
+ right, left));
break;
case SK_NEGATE | SK_COMMUTE:
- tmpres = (long) !FMGR_PTR2(&entry->sk_func,
- right, left);
+ result = ! DatumGetBool(FunctionCall2(&entry->sk_func,
+ right, left));
break;
default:
- elog(FATAL, "StrategyTermEvaluate: impossible case %d",
+ elog(ERROR, "StrategyTermEvaluate: impossible case %d",
operator->flags ^ entry->sk_flags);
}
-
- result = (bool) tmpres;
if (!result)
return result;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.57 2000/04/12 17:14:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.58 2000/05/30 04:24:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
else
{
- compare = (int32) FMGR_PTR2(&entry->sk_func,
- attrDatum1, attrDatum2);
+ compare = DatumGetInt32(FunctionCall2(&entry->sk_func,
+ attrDatum1, attrDatum2));
}
if (compare != 0)
IndexTuple itup;
ScanKey entry;
AttrNumber attno;
- long result;
+ int32 result;
int i;
bool null;
if (entry->sk_flags & SK_ISNULL || null)
return false;
- result = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
+ result = DatumGetInt32(FunctionCall2(&entry->sk_func,
+ entry->sk_argument, datum));
if (result != 0)
return false;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.59 2000/04/12 17:14:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.60 2000/05/30 04:24:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static BTStack _bt_searchr(Relation rel, int keysz, ScanKey scankey,
Buffer *bufP, BTStack stack_in);
-static int _bt_compare(Relation rel, TupleDesc itupdesc, Page page,
- int keysz, ScanKey scankey, OffsetNumber offnum);
+static int32 _bt_compare(Relation rel, TupleDesc itupdesc, Page page,
+ int keysz, ScanKey scankey, OffsetNumber offnum);
static bool
_bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
static RetrieveIndexResult
ScanKey entry = &scankey[i - 1];
Datum attrDatum;
bool isNull;
- Datum keyDatum;
Assert(entry->sk_attno == i);
attrDatum = index_getattr(indexTuple,
entry->sk_attno,
tupDes,
&isNull);
- keyDatum = entry->sk_argument;
/* see comments about NULLs handling in btbuild */
if (entry->sk_flags & SK_ISNULL) /* key is NULL */
compare = -1; /* not-NULL key "<" NULL datum */
}
else
- compare = (int32) FMGR_PTR2(&entry->sk_func, keyDatum, attrDatum);
+ compare = DatumGetInt32(FunctionCall2(&entry->sk_func,
+ entry->sk_argument,
+ attrDatum));
if (compare != 0)
break; /* done when we find unequal attributes */
high;
bool haveEq;
int natts = rel->rd_rel->relnatts;
- int result;
+ int32 result;
itupdesc = RelationGetDescr(rel);
page = BufferGetPage(buf);
* _bt_compare() -- Compare scankey to a particular tuple on the page.
*
* This routine returns:
- * -1 if scankey < tuple at offnum;
+ * <0 if scankey < tuple at offnum;
* 0 if scankey == tuple at offnum;
- * +1 if scankey > tuple at offnum.
+ * >0 if scankey > tuple at offnum.
*
* -- Old comments:
* In order to avoid having to propagate changes up the tree any time
* but not "any time a new min key is inserted" (see _bt_insertonpg).
* - vadim 12/05/96
*/
-static int
+static int32
_bt_compare(Relation rel,
TupleDesc itupdesc,
Page page,
BTPageOpaque opaque;
ScanKey entry;
AttrNumber attno;
- int result;
+ int32 result;
int i;
bool null;
for (i = 1; i <= keysz; i++)
{
- long tmpres;
-
entry = &scankey[i - 1];
attno = entry->sk_attno;
datum = index_getattr(itup, attno, itupdesc, &null);
if (entry->sk_flags & SK_ISNULL) /* key is NULL */
{
if (null)
- tmpres = (long) 0; /* NULL "=" NULL */
+ result = 0; /* NULL "=" NULL */
else
- tmpres = (long) 1; /* NULL ">" NOT_NULL */
+ result = 1; /* NULL ">" NOT_NULL */
}
else if (null) /* key is NOT_NULL and item is NULL */
{
- tmpres = (long) -1; /* NOT_NULL "<" NULL */
+ result = -1; /* NOT_NULL "<" NULL */
}
else
- tmpres = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
- result = tmpres;
+ result = DatumGetInt32(FunctionCall2(&entry->sk_func,
+ entry->sk_argument, datum));
/* if the keys are unequal, return the difference */
if (result != 0)
StrategyNumber strat;
RetrieveIndexResult res;
RegProcedure proc;
- int result;
+ int32 result;
BTScanOpaque so;
Size keysok;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.36 2000/04/12 17:14:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.37 2000/05/30 04:24:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
ScanKeyData *cur;
StrategyMap map;
int nbytes;
- long test;
+ Datum test;
int i,
j;
int init[BTMaxStrategyNumber + 1];
if (j == (BTEqualStrategyNumber - 1) || init[j] == 0)
continue;
chk = &xform[j];
- test = (long) fmgr(chk->sk_procedure, eq->sk_argument, chk->sk_argument);
- if (!test)
+ test = OidFunctionCall2(chk->sk_procedure,
+ eq->sk_argument, chk->sk_argument);
+ if (!DatumGetBool(test))
so->qual_ok = 0;
}
init[BTLessStrategyNumber - 1] = 0;
* anyway. The transform maps are hard-coded, and can't
* be initialized in the correct way.
*/
- test = (long) fmgr(le->sk_procedure, lt->sk_argument, le->sk_argument);
- if (test)
+ test = OidFunctionCall2(le->sk_procedure,
+ lt->sk_argument, le->sk_argument);
+ if (DatumGetBool(test))
init[BTLessEqualStrategyNumber - 1] = 0;
else
init[BTLessStrategyNumber - 1] = 0;
ge = &xform[BTGreaterEqualStrategyNumber - 1];
/* see note above on function cache */
- test = (long) fmgr(ge->sk_procedure, gt->sk_argument, ge->sk_argument);
- if (test)
+ test = OidFunctionCall2(ge->sk_procedure,
+ gt->sk_argument, ge->sk_argument);
+ if (DatumGetBool(test))
init[BTGreaterEqualStrategyNumber - 1] = 0;
else
init[BTGreaterStrategyNumber - 1] = 0;
if (init[j])
{
/* yup, use the appropriate value */
- test = (long) FMGR_PTR2(&cur->sk_func, cur->sk_argument, xform[j].sk_argument);
- if (test)
+ test = FunctionCall2(&cur->sk_func,
+ cur->sk_argument, xform[j].sk_argument);
+ if (DatumGetBool(test))
xform[j].sk_argument = cur->sk_argument;
else if (j == (BTEqualStrategyNumber - 1))
so->qual_ok = 0;/* key == a && key == b, but a != b */
ScanKey key;
Datum datum;
bool isNull;
- int test;
+ Datum test;
*keysok = 0;
if (keysz == 0)
if (key[0].sk_flags & SK_COMMUTE)
{
- test = (int) (*fmgr_faddr(&key[0].sk_func))
- (DatumGetPointer(key[0].sk_argument),
- datum);
+ test = FunctionCall2(&key[0].sk_func,
+ key[0].sk_argument, datum);
}
else
{
- test = (int) (*fmgr_faddr(&key[0].sk_func))
- (datum,
- DatumGetPointer(key[0].sk_argument));
+ test = FunctionCall2(&key[0].sk_func,
+ datum, key[0].sk_argument);
}
- if (!test == !(key[0].sk_flags & SK_NEGATE))
+ if (DatumGetBool(test) == !!(key[0].sk_flags & SK_NEGATE))
return false;
keysz -= 1;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.46 2000/05/30 00:49:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.47 2000/05/30 04:24:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
oldud = (char *) PageGetItem(p, PageGetItemId(p, stk->rts_child));
oldud += sizeof(IndexTupleData);
- (*fmgr_faddr(&rtstate->sizeFn)) (oldud, &old_size);
- datum = (char *) (*fmgr_faddr(&rtstate->unionFn)) (oldud, datum);
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(oldud),
+ PointerGetDatum(&old_size));
- (*fmgr_faddr(&rtstate->sizeFn)) (datum, &newd_size);
+ datum = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(oldud),
+ PointerGetDatum(datum)));
+
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(datum),
+ PointerGetDatum(&newd_size));
if (newd_size != old_size)
{
* union proc, which is guaranteed to return a rectangle.
*/
- tdatum = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum, datum);
+ tdatum = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(datum),
+ PointerGetDatum(datum)));
rttighten(r, stk->rts_parent, tdatum, att_size, rtstate);
pfree(tdatum);
}
WriteBuffer(b);
ldatum = (((char *) ltup) + sizeof(IndexTupleData));
rdatum = (((char *) rtup) + sizeof(IndexTupleData));
- newdatum = (char *) (*fmgr_faddr(&rtstate->unionFn)) (ldatum, rdatum);
+ newdatum = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(ldatum),
+ PointerGetDatum(rdatum)));
rttighten(r, stk->rts_parent, newdatum,
(IndexTupleSize(rtup) - sizeof(IndexTupleData)), rtstate);
datum_beta = ((char *) item_2) + sizeof(IndexTupleData);
/* compute the wasted space by unioning these guys */
- union_d = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_alpha, datum_beta);
- (*fmgr_faddr(&rtstate->sizeFn)) (union_d, &size_union);
- inter_d = (char *) (*fmgr_faddr(&rtstate->interFn)) (datum_alpha, datum_beta);
- (*fmgr_faddr(&rtstate->sizeFn)) (inter_d, &size_inter);
+ union_d = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(datum_alpha),
+ PointerGetDatum(datum_beta)));
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(union_d),
+ PointerGetDatum(&size_union));
+ inter_d = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->interFn,
+ PointerGetDatum(datum_alpha),
+ PointerGetDatum(datum_beta)));
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(inter_d),
+ PointerGetDatum(&size_inter));
size_waste = size_union - size_inter;
pfree(union_d);
item_1 = (IndexTuple) PageGetItem(page, PageGetItemId(page, seed_1));
datum_alpha = ((char *) item_1) + sizeof(IndexTupleData);
- datum_l = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_alpha, datum_alpha);
- (*fmgr_faddr(&rtstate->sizeFn)) (datum_l, &size_l);
+ datum_l = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(datum_alpha),
+ PointerGetDatum(datum_alpha)));
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(datum_l),
+ PointerGetDatum(&size_l));
item_2 = (IndexTuple) PageGetItem(page, PageGetItemId(page, seed_2));
datum_beta = ((char *) item_2) + sizeof(IndexTupleData);
- datum_r = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_beta, datum_beta);
- (*fmgr_faddr(&rtstate->sizeFn)) (datum_r, &size_r);
+ datum_r = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(datum_beta),
+ PointerGetDatum(datum_beta)));
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(datum_r),
+ PointerGetDatum(&size_r));
/*
* Now split up the regions between the two seeds. An important
item_1 = (IndexTuple) PageGetItem(page, PageGetItemId(page, i));
datum_alpha = ((char *) item_1) + sizeof(IndexTupleData);
- union_dl = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_l, datum_alpha);
- union_dr = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum_r, datum_alpha);
- (*fmgr_faddr(&rtstate->sizeFn)) (union_dl, &size_alpha);
- (*fmgr_faddr(&rtstate->sizeFn)) (union_dr, &size_beta);
+ union_dl = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(datum_l),
+ PointerGetDatum(datum_alpha)));
+ union_dr = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(datum_r),
+ PointerGetDatum(datum_alpha)));
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(union_dl),
+ PointerGetDatum(&size_alpha));
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(union_dr),
+ PointerGetDatum(&size_beta));
/* pick which page to add it to */
if (size_alpha - size_l < size_beta - size_r)
{
datum = (char *) PageGetItem(p, PageGetItemId(p, i));
datum += sizeof(IndexTupleData);
- (*fmgr_faddr(&rtstate->sizeFn)) (datum, &dsize);
- ud = (char *) (*fmgr_faddr(&rtstate->unionFn)) (datum, id);
- (*fmgr_faddr(&rtstate->sizeFn)) (ud, &usize);
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(datum),
+ PointerGetDatum(&dsize));
+ ud = (char *)
+ DatumGetPointer(FunctionCall2(&rtstate->unionFn,
+ PointerGetDatum(datum),
+ PointerGetDatum(id)));
+ FunctionCall2(&rtstate->sizeFn,
+ PointerGetDatum(ud),
+ PointerGetDatum(&usize));
pfree(ud);
if (which_grow < 0 || usize - dsize < which_grow)
{
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.82 2000/05/28 17:55:53 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.83 2000/05/30 04:24:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static char *relname; /* current relation name */
Form_pg_attribute attrtypes[MAXATTR]; /* points to attribute info */
-static char *values[MAXATTR]; /* cooresponding attribute values */
+static Datum values[MAXATTR]; /* corresponding attribute values */
int numattr; /* number of attributes for cur. rel */
int DebugMode;
}
tupDesc = CreateTupleDesc(numattr, attrtypes);
- tuple = heap_formtuple(tupDesc, (Datum *) values, Blanks);
+ tuple = heap_formtuple(tupDesc, values, Blanks);
pfree(tupDesc); /* just free's tupDesc, not the attrtypes */
if (objectid != (Oid) 0)
);
Assert(0);
}
- values[i] = fmgr(ap->am_typ.typinput,
- value,
- ap->am_typ.typelem,
- -1);
- prt = fmgr(ap->am_typ.typoutput, values[i],
- ap->am_typ.typelem,
- -1);
+ values[i] = OidFunctionCall3(ap->am_typ.typinput,
+ CStringGetDatum(value),
+ ObjectIdGetDatum(ap->am_typ.typelem),
+ Int32GetDatum(-1));
+ prt = DatumGetCString(OidFunctionCall3(ap->am_typ.typoutput,
+ values[i],
+ ObjectIdGetDatum(ap->am_typ.typelem),
+ Int32GetDatum(-1)));
if (!Quiet)
printf("%s ", prt);
pfree(prt);
elog(ERROR, "can't find type OID %u", attrtypes[i]->atttypid);
if (DebugMode)
printf("Typ == NULL, typeindex = %u idx = %d\n", typeindex, i);
- values[i] = fmgr(Procid[typeindex].inproc, value,
- Procid[typeindex].elem, -1);
- prt = fmgr(Procid[typeindex].outproc, values[i],
- Procid[typeindex].elem);
+ values[i] = OidFunctionCall3(Procid[typeindex].inproc,
+ CStringGetDatum(value),
+ ObjectIdGetDatum(Procid[typeindex].elem),
+ Int32GetDatum(-1));
+ prt = DatumGetCString(OidFunctionCall3(Procid[typeindex].outproc,
+ values[i],
+ ObjectIdGetDatum(Procid[typeindex].elem),
+ Int32GetDatum(-1)));
if (!Quiet)
printf("%s ", prt);
pfree(prt);
printf("Inserting null\n");
if (i < 0 || i >= MAXATTR)
elog(FATAL, "i out of range (too many attrs): %d\n", i);
- values[i] = (char *) NULL;
+ values[i] = PointerGetDatum(NULL);
Blanks[i] = 'n';
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.112 2000/05/30 00:49:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.113 2000/05/30 04:24:35 tgl Exp $
*
*
* INTERFACE ROUTINES
* ----------------
*/
if (RegProcedureIsValid(procedure))
- fmgr(procedure,
- heapRelation,
- indexRelation,
- numberOfAttributes,
- attributeNumber,
- RelationGetIndexStrategy(indexRelation),
- parameterCount,
- parameter,
- funcInfo,
- predInfo);
+ OidFunctionCall9(procedure,
+ PointerGetDatum(heapRelation),
+ PointerGetDatum(indexRelation),
+ Int32GetDatum(numberOfAttributes),
+ PointerGetDatum(attributeNumber),
+ PointerGetDatum(RelationGetIndexStrategy(indexRelation)),
+ UInt16GetDatum(parameterCount),
+ PointerGetDatum(parameter),
+ PointerGetDatum(funcInfo),
+ PointerGetDatum(predInfo));
else
DefaultBuild(heapRelation,
indexRelation,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.32 2000/04/16 04:16:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.33 2000/05/30 04:24:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
heap_close(aggdesc, RowExclusiveLock);
}
-char *
+Datum
AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
{
HeapTuple tup;
typinput,
typelem;
text *textInitVal;
- char *strInitVal,
- *initVal;
+ char *strInitVal;
+ Datum initVal;
Assert(PointerIsValid(aggName));
Assert(PointerIsValid(isNull));
if (*isNull)
{
heap_close(aggRel, AccessShareLock);
- return (char *) NULL;
+ return PointerGetDatum(NULL);
}
strInitVal = textout(textInitVal);
typinput = ((Form_pg_type) GETSTRUCT(tup))->typinput;
typelem = ((Form_pg_type) GETSTRUCT(tup))->typelem;
- initVal = fmgr(typinput, strInitVal, typelem, -1);
+ initVal = OidFunctionCall3(typinput,
+ CStringGetDatum(strInitVal),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(-1));
pfree(strInitVal);
return initVal;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.1 2000/05/29 17:44:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.2 2000/05/30 04:25:00 tgl Exp $
*
*-------------------------------------------------------------------------
* frequently in each column. These figures are used to compute
* the selectivity of the column.
*
- * We use a three-bucked cache to get the most frequent item.
+ * We use a three-bucket cache to get the most frequent item.
* The 'guess' buckets count hits. A cache miss causes guess1
* to get the most hit 'guess' item in the most recent cycle, and
* the new item goes into guess2. Whenever the total count of hits
{
int i;
TupleDesc tupDesc = onerel->rd_att;
- Datum value;
- bool isnull;
for (i = 0; i < attr_cnt; i++)
{
VacAttrStats *stats = &vacattrstats[i];
- bool value_hit = true;
+ Datum value;
+ bool isnull;
+ bool value_hit;
+
+ if (!VacAttrStatsEqValid(stats))
+ continue;
#ifdef _DROP_COLUMN_HACK__
if (COLUMN_IS_DROPPED(stats->attr))
continue;
#endif /* _DROP_COLUMN_HACK__ */
+
value = heap_getattr(tuple,
stats->attr->attnum, tupDesc, &isnull);
- if (!VacAttrStatsEqValid(stats))
- continue;
-
if (isnull)
+ {
stats->null_cnt++;
- else
+ continue;
+ }
+
+ stats->nonnull_cnt++;
+ if (! stats->initialized)
{
- stats->nonnull_cnt++;
- if (stats->initialized == false)
- {
- bucketcpy(stats->attr, value, &stats->best, &stats->best_len);
- /* best_cnt gets incremented later */
- bucketcpy(stats->attr, value, &stats->guess1, &stats->guess1_len);
- stats->guess1_cnt = stats->guess1_hits = 1;
- bucketcpy(stats->attr, value, &stats->guess2, &stats->guess2_len);
- stats->guess2_hits = 1;
- if (VacAttrStatsLtGtValid(stats))
- {
- bucketcpy(stats->attr, value, &stats->max, &stats->max_len);
- bucketcpy(stats->attr, value, &stats->min, &stats->min_len);
- }
- stats->initialized = true;
- }
+ bucketcpy(stats->attr, value, &stats->best, &stats->best_len);
+ /* best_cnt gets incremented below */
+ bucketcpy(stats->attr, value, &stats->guess1, &stats->guess1_len);
+ stats->guess1_cnt = stats->guess1_hits = 1;
+ bucketcpy(stats->attr, value, &stats->guess2, &stats->guess2_len);
+ stats->guess2_hits = 1;
if (VacAttrStatsLtGtValid(stats))
{
- if ((*fmgr_faddr(&stats->f_cmplt)) (value, stats->min))
- {
- bucketcpy(stats->attr, value, &stats->min, &stats->min_len);
- stats->min_cnt = 0;
- }
- if ((*fmgr_faddr(&stats->f_cmpgt)) (value, stats->max))
- {
- bucketcpy(stats->attr, value, &stats->max, &stats->max_len);
- stats->max_cnt = 0;
- }
- if ((*fmgr_faddr(&stats->f_cmpeq)) (value, stats->min))
- stats->min_cnt++;
- else if ((*fmgr_faddr(&stats->f_cmpeq)) (value, stats->max))
- stats->max_cnt++;
+ bucketcpy(stats->attr, value, &stats->max, &stats->max_len);
+ bucketcpy(stats->attr, value, &stats->min, &stats->min_len);
+ /* min_cnt, max_cnt get incremented below */
}
- if ((*fmgr_faddr(&stats->f_cmpeq)) (value, stats->best))
- stats->best_cnt++;
- else if ((*fmgr_faddr(&stats->f_cmpeq)) (value, stats->guess1))
- {
- stats->guess1_cnt++;
- stats->guess1_hits++;
- }
- else if ((*fmgr_faddr(&stats->f_cmpeq)) (value, stats->guess2))
- stats->guess2_hits++;
- else
- value_hit = false;
+ stats->initialized = true;
+ }
- if (stats->guess2_hits > stats->guess1_hits)
- {
- swapDatum(stats->guess1, stats->guess2);
- swapInt(stats->guess1_len, stats->guess2_len);
- swapLong(stats->guess1_hits, stats->guess2_hits);
- stats->guess1_cnt = stats->guess1_hits;
- }
- if (stats->guess1_cnt > stats->best_cnt)
+ if (VacAttrStatsLtGtValid(stats))
+ {
+ if (DatumGetBool(FunctionCall2(&stats->f_cmplt,
+ value, stats->min)))
{
- swapDatum(stats->best, stats->guess1);
- swapInt(stats->best_len, stats->guess1_len);
- swapLong(stats->best_cnt, stats->guess1_cnt);
- stats->guess1_hits = 1;
- stats->guess2_hits = 1;
+ bucketcpy(stats->attr, value, &stats->min, &stats->min_len);
+ stats->min_cnt = 1;
}
- if (!value_hit)
+ else if (DatumGetBool(FunctionCall2(&stats->f_cmpeq,
+ value, stats->min)))
+ stats->min_cnt++;
+
+ if (DatumGetBool(FunctionCall2(&stats->f_cmpgt,
+ value, stats->max)))
{
- bucketcpy(stats->attr, value, &stats->guess2, &stats->guess2_len);
- stats->guess1_hits = 1;
- stats->guess2_hits = 1;
+ bucketcpy(stats->attr, value, &stats->max, &stats->max_len);
+ stats->max_cnt = 1;
}
+ else if (DatumGetBool(FunctionCall2(&stats->f_cmpeq,
+ value, stats->max)))
+ stats->max_cnt++;
+ }
+
+ value_hit = true;
+ if (DatumGetBool(FunctionCall2(&stats->f_cmpeq,
+ value, stats->best)))
+ stats->best_cnt++;
+ else if (DatumGetBool(FunctionCall2(&stats->f_cmpeq,
+ value, stats->guess1)))
+ {
+ stats->guess1_cnt++;
+ stats->guess1_hits++;
+ }
+ else if (DatumGetBool(FunctionCall2(&stats->f_cmpeq,
+ value, stats->guess2)))
+ stats->guess2_hits++;
+ else
+ value_hit = false;
+
+ if (stats->guess2_hits > stats->guess1_hits)
+ {
+ swapDatum(stats->guess1, stats->guess2);
+ swapInt(stats->guess1_len, stats->guess2_len);
+ swapLong(stats->guess1_hits, stats->guess2_hits);
+ stats->guess1_cnt = stats->guess1_hits;
+ }
+ if (stats->guess1_cnt > stats->best_cnt)
+ {
+ swapDatum(stats->best, stats->guess1);
+ swapInt(stats->best_len, stats->guess1_len);
+ swapLong(stats->best_cnt, stats->guess1_cnt);
+ stats->guess1_hits = 1;
+ stats->guess2_hits = 1;
+ }
+ if (!value_hit)
+ {
+ bucketcpy(stats->attr, value, &stats->guess2, &stats->guess2_len);
+ stats->guess1_hits = 1;
+ stats->guess2_hits = 1;
}
}
- return;
}
/*
- * bucketcpy() -- update pg_class statistics for one relation
+ * bucketcpy() -- copy a new value into one of the statistics buckets
*
*/
static void
*bucket = PointerGetDatum(palloc(len));
*bucket_len = len;
}
- memmove(DatumGetPointer(*bucket), DatumGetPointer(value), len);
+ memcpy(DatumGetPointer(*bucket), DatumGetPointer(value), len);
}
}
* ----------------
*/
i = 0;
- values[i++] = (Datum) relid; /* starelid */
- values[i++] = (Datum) attp->attnum; /* staattnum */
- values[i++] = (Datum) stats->op_cmplt; /* staop */
+ values[i++] = ObjectIdGetDatum(relid); /* starelid */
+ values[i++] = Int16GetDatum(attp->attnum); /* staattnum */
+ values[i++] = ObjectIdGetDatum(stats->op_cmplt); /* staop */
/* hack: this code knows float4 is pass-by-ref */
- values[i++] = PointerGetDatum(&nullratio); /* stanullfrac */
- values[i++] = PointerGetDatum(&bestratio); /* stacommonfrac */
- out_string = (*fmgr_faddr(&out_function)) (stats->best, stats->typelem, stats->attr->atttypmod);
+ values[i++] = Float32GetDatum(&nullratio); /* stanullfrac */
+ values[i++] = Float32GetDatum(&bestratio); /* stacommonfrac */
+ out_string = DatumGetCString(FunctionCall3(&out_function,
+ stats->best,
+ ObjectIdGetDatum(stats->typelem),
+ Int32GetDatum(stats->attr->atttypmod)));
values[i++] = PointerGetDatum(textin(out_string)); /* stacommonval */
pfree(out_string);
- out_string = (*fmgr_faddr(&out_function)) (stats->min, stats->typelem, stats->attr->atttypmod);
+ out_string = DatumGetCString(FunctionCall3(&out_function,
+ stats->min,
+ ObjectIdGetDatum(stats->typelem),
+ Int32GetDatum(stats->attr->atttypmod)));
values[i++] = PointerGetDatum(textin(out_string)); /* staloval */
pfree(out_string);
- out_string = (char *) (*fmgr_faddr(&out_function)) (stats->max, stats->typelem, stats->attr->atttypmod);
+ out_string = DatumGetCString(FunctionCall3(&out_function,
+ stats->max,
+ ObjectIdGetDatum(stats->typelem),
+ Int32GetDatum(stats->attr->atttypmod)));
values[i++] = PointerGetDatum(textin(out_string)); /* stahival */
pfree(out_string);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.108 2000/05/30 00:49:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.109 2000/05/30 04:25:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#endif /* _DROP_COLUMN_HACK__ */
if (!isnull)
{
- string = (char *) (*fmgr_faddr(&out_functions[i]))
- (value, elements[i], typmod[i]);
+ string = DatumGetCString(FunctionCall3(&out_functions[i],
+ value,
+ ObjectIdGetDatum(elements[i]),
+ Int32GetDatum(typmod[i])));
CopyAttributeOut(fp, string, delim);
pfree(string);
}
done = 1;
else
{
- values[i] = (Datum) (*fmgr_faddr(&in_functions[i])) (string,
- elements[i],
- typmod[i]);
-
- /*
- * Sanity check - by reference attributes cannot
- * return NULL
- */
- if (!PointerIsValid(values[i]) &&
- !(rel->rd_att->attrs[i]->attbyval))
- elog(ERROR, "COPY: Bad file format");
+ values[i] = FunctionCall3(&in_functions[i],
+ CStringGetDatum(string),
+ ObjectIdGetDatum(elements[i]),
+ Int32GetDatum(typmod[i]));
}
}
if (!done)
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.65 2000/05/30 00:49:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.66 2000/05/30 04:24:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
continue;
if (haveOldVal)
{
- Datum equal;
-
- equal = (Datum) (*fmgr_faddr(&peraggstate->equalfn)) (oldVal,
- newVal);
- if (DatumGetInt32(equal) != 0)
+ if (DatumGetBool(FunctionCall2(&peraggstate->equalfn,
+ oldVal, newVal)))
{
+ /* equal to prior, so forget this one */
if (!peraggstate->inputtypeByVal)
pfree(DatumGetPointer(newVal));
continue;
typeidTypeName(aggref->basetype));
aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple);
- peraggstate->initValue1 = (Datum)
+ peraggstate->initValue1 =
AggNameGetInitVal(aggname,
aggform->aggbasetype,
1,
&peraggstate->initValue1IsNull);
- peraggstate->initValue2 = (Datum)
+ peraggstate->initValue2 =
AggNameGetInitVal(aggname,
aggform->aggbasetype,
2,
* locate group boundaries.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.35 2000/05/30 00:49:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.36 2000/05/30 04:24:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
attr2;
bool isNull1,
isNull2;
- Datum equal;
attr1 = heap_getattr(tuple1,
att,
/* Apply the type-specific equality function */
- equal = (Datum) (*fmgr_faddr(&eqfunctions[i])) (attr1, attr2);
-
- if (DatumGetInt32(equal) == 0)
+ if (! DatumGetBool(FunctionCall2(&eqfunctions[i],
+ attr1, attr2)))
return FALSE;
}
* spi.c
* Server Programming Interface
*
- * $Id: spi.c,v 1.45 2000/04/04 21:44:39 tgl Exp $
+ * $Id: spi.c,v 1.46 2000/05/30 04:24:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
return NULL;
}
- return (fmgr(foutoid, val, typelem,
- tupdesc->attrs[fnumber - 1]->atttypmod));
+ return DatumGetCString(OidFunctionCall3(foutoid,
+ val,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[fnumber - 1]->atttypmod)));
}
Datum
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: be-dumpdata.c,v 1.33 2000/04/12 17:15:14 momjian Exp $
+ * $Id: be-dumpdata.c,v 1.34 2000/05/30 04:24:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
if (!isnull && OidIsValid(typoutput))
- values[i] = fmgr(typoutput, attr, typelem,
- typeinfo->attrs[i]->atttypmod);
+ values[i] = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(typeinfo->attrs[i]->atttypmod)));
else
values[i] = NULL;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.59 2000/05/30 00:49:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.60 2000/05/30 04:24:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* index (ie, the fraction of main-table tuples we will have to
* retrieve).
*/
- fmgr(index->amcostestimate, root, baserel, index, indexQuals,
- &indexStartupCost, &indexTotalCost, &indexSelectivity);
+ OidFunctionCall7(index->amcostestimate,
+ PointerGetDatum(root),
+ PointerGetDatum(baserel),
+ PointerGetDatum(index),
+ PointerGetDatum(indexQuals),
+ PointerGetDatum(&indexStartupCost),
+ PointerGetDatum(&indexTotalCost),
+ PointerGetDatum(&indexSelectivity));
/* all costs for touching index itself included here */
startup_cost += indexStartupCost;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.52 2000/05/30 00:49:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.53 2000/05/30 04:24:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Datum constValue,
int constFlag)
{
- float64 result;
-
- result = (float64) fmgr(functionObjectId,
- (char *) operatorObjectId,
- (char *) relationObjectId,
- (char *) (int) attributeNumber,
- (char *) constValue,
- (char *) constFlag,
- NULL);
- if (!PointerIsValid(result))
- elog(ERROR, "restriction_selectivity: bad pointer");
-
- if (*result < 0.0 || *result > 1.0)
- elog(ERROR, "restriction_selectivity: bad value %f", *result);
-
- return (Selectivity) *result;
+ float8 result;
+
+ result = DatumGetFloat8(OidFunctionCall5(functionObjectId,
+ ObjectIdGetDatum(operatorObjectId),
+ ObjectIdGetDatum(relationObjectId),
+ Int16GetDatum(attributeNumber),
+ constValue,
+ Int32GetDatum(constFlag)));
+
+ if (result < 0.0 || result > 1.0)
+ elog(ERROR, "restriction_selectivity: bad value %f", result);
+
+ return (Selectivity) result;
}
/*
Oid relationObjectId2,
AttrNumber attributeNumber2)
{
- float64 result;
-
- result = (float64) fmgr(functionObjectId,
- (char *) operatorObjectId,
- (char *) relationObjectId1,
- (char *) (int) attributeNumber1,
- (char *) relationObjectId2,
- (char *) (int) attributeNumber2,
- NULL);
- if (!PointerIsValid(result))
- elog(ERROR, "join_selectivity: bad pointer");
-
- if (*result < 0.0 || *result > 1.0)
- elog(ERROR, "join_selectivity: bad value %f", *result);
-
- return (Selectivity) *result;
+ float8 result;
+
+ result = DatumGetFloat8(OidFunctionCall5(functionObjectId,
+ ObjectIdGetDatum(operatorObjectId),
+ ObjectIdGetDatum(relationObjectId1),
+ Int16GetDatum(attributeNumber1),
+ ObjectIdGetDatum(relationObjectId2),
+ Int16GetDatum(attributeNumber2)));
+
+ if (result < 0.0 || result > 1.0)
+ elog(ERROR, "join_selectivity: bad value %f", result);
+
+ return (Selectivity) result;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.29 2000/01/26 05:56:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.30 2000/05/30 04:24:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
op = ((Form_pg_type) GETSTRUCT(tp))->typinput;
typelem = ((Form_pg_type) GETSTRUCT(tp))->typelem; /* XXX - used for
* array_in */
- return (Datum) fmgr(op, string, typelem, atttypmod);
+ return OidFunctionCall3(op,
+ CStringGetDatum(string),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(atttypmod));
}
/* Given a type id, returns the out-conversion function of the type */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.53 2000/05/29 21:02:32 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.54 2000/05/30 04:24:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*q = '\0';
if (i >= nitems)
elog(ERROR, "array_in: illformed array constant");
- values[i] = (*fmgr_faddr(inputproc)) (p, typelem, typmod);
+ values[i] = (char *) FunctionCall3(inputproc,
+ CStringGetDatum(p),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(typmod));
p = ++q;
if (!eoArray)
switch (typlen)
{
case 1:
- values[i] = (*fmgr_faddr(&outputproc)) (*p, typelem, -1);
+ values[i] = DatumGetCString(FunctionCall3(&outputproc,
+ CharGetDatum(*p),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(-1)));
break;
case 2:
- values[i] = (*fmgr_faddr(&outputproc)) (*(int16 *) p, typelem, -1);
+ values[i] = DatumGetCString(FunctionCall3(&outputproc,
+ Int16GetDatum(*(int16 *) p),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(-1)));
break;
case 3:
case 4:
- values[i] = (*fmgr_faddr(&outputproc)) (*(int32 *) p, typelem, -1);
+ values[i] = DatumGetCString(FunctionCall3(&outputproc,
+ Int32GetDatum(*(int32 *) p),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(-1)));
break;
}
p += typlen;
}
else
{
- values[i] = (*fmgr_faddr(&outputproc)) (p, typelem, -1);
+ values[i] = DatumGetCString(FunctionCall3(&outputproc,
+ PointerGetDatum(p),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(-1)));
if (typlen > 0)
p += typlen;
else
* out of its tuple
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.49 2000/05/30 00:49:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.50 2000/05/30 04:24:51 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
StringInfo buf = context->buf;
HeapTuple typetup;
Form_pg_type typeStruct;
- FmgrInfo finfo_output;
char *extval;
char *valptr;
return;
}
- fmgr_info(typeStruct->typoutput, &finfo_output);
- extval = (char *) (*fmgr_faddr(&finfo_output)) (constval->constvalue,
- typeStruct->typelem,
- -1);
+ extval = DatumGetCString(OidFunctionCall3(typeStruct->typoutput,
+ constval->constvalue,
+ ObjectIdGetDatum(typeStruct->typelem),
+ Int32GetDatum(-1)));
switch (constval->consttype)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.67 2000/05/28 17:56:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.68 2000/05/30 04:24:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "catalog/pg_statistic.h"
#include "catalog/pg_type.h"
#include "mb/pg_wchar.h"
+#include "optimizer/clauses.h"
#include "optimizer/cost.h"
#include "parser/parse_func.h"
#include "parser/parse_oper.h"
/* be careful to apply operator right way 'round */
if (flag & SEL_RIGHT)
- mostcommon = (bool)
- DatumGetUInt8(fmgr(eqproc, commonval, value));
+ mostcommon = DatumGetBool(OidFunctionCall2(eqproc,
+ commonval,
+ value));
else
- mostcommon = (bool)
- DatumGetUInt8(fmgr(eqproc, value, commonval));
+ mostcommon = DatumGetBool(OidFunctionCall2(eqproc,
+ value,
+ commonval));
if (mostcommon)
{
{
char *strval = textout(val);
- *commonval = (Datum)
- (*fmgr_faddr(&inputproc)) (strval, typelem, typmod);
+ *commonval = FunctionCall3(&inputproc,
+ CStringGetDatum(strval),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(typmod));
pfree(strval);
}
}
if (loval)
{
text *val = (text *) SysCacheGetAttr(STATRELID, tuple,
- Anum_pg_statistic_staloval,
+ Anum_pg_statistic_staloval,
&isnull);
if (isnull)
{
char *strval = textout(val);
- *loval = (Datum)
- (*fmgr_faddr(&inputproc)) (strval, typelem, typmod);
+ *loval = FunctionCall3(&inputproc,
+ CStringGetDatum(strval),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(typmod));
pfree(strval);
}
}
{
char *strval = textout(val);
- *hival = (Datum)
- (*fmgr_faddr(&inputproc)) (strval, typelem, typmod);
+ *hival = FunctionCall3(&inputproc,
+ CStringGetDatum(strval),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(typmod));
pfree(strval);
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.41 2000/05/29 01:59:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.42 2000/05/30 04:24:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
return 0; /* keep compiler happy */
}
+#if 0
+
/*
* Interface routine for functions using fmgr_faddr
*/
return (char *) result;
}
+#endif
+
/*-------------------------------------------------------------------------
* Support routines for callers of fmgr-compatible functions
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.9 2000/04/12 17:16:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.10 2000/05/30 04:24:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
rattr;
bool isnull1,
isnull2;
- int result;
lattr = heap_getattr(ltup, attno, tupDesc, &isnull1);
rattr = heap_getattr(rtup, attno, tupDesc, &isnull2);
return -1;
else if (scanKey->sk_flags & SK_COMMUTE)
{
- if (!(result = -(int) (*fmgr_faddr(&scanKey->sk_func)) (rattr, lattr)))
- result = (int) (*fmgr_faddr(&scanKey->sk_func)) (lattr, rattr);
- if (result)
- return result;
+ if (DatumGetBool(FunctionCall2(&scanKey->sk_func,
+ rattr, lattr)))
+ return -1; /* a < b after commute */
+ if (DatumGetBool(FunctionCall2(&scanKey->sk_func,
+ lattr, rattr)))
+ return 1; /* a > b after commute */
}
else
{
- if (!(result = -(int) (*fmgr_faddr(&scanKey->sk_func)) (lattr, rattr)))
- result = (int) (*fmgr_faddr(&scanKey->sk_func)) (rattr, lattr);
- if (result)
- return result;
+ if (DatumGetBool(FunctionCall2(&scanKey->sk_func,
+ lattr, rattr)))
+ return -1; /* a < b */
+ if (DatumGetBool(FunctionCall2(&scanKey->sk_func,
+ rattr, lattr)))
+ return 1; /* a > b */
}
}
}
else
{
- compare = (int32) FMGR_PTR2(&entry->sk_func,
- attrDatum1, attrDatum2);
+ compare = DatumGetInt32(FunctionCall2(&entry->sk_func,
+ attrDatum1, attrDatum2));
}
if (compare != 0)
return -1;
else
{
- int result;
-
- if (!(result = -(int) (*fmgr_faddr(&state->sortOpFn)) (ltup->val,
- rtup->val)))
- result = (int) (*fmgr_faddr(&state->sortOpFn)) (rtup->val,
- ltup->val);
- return result;
+ if (DatumGetBool(FunctionCall2(&state->sortOpFn,
+ ltup->val, rtup->val)))
+ return -1; /* a < b */
+ if (DatumGetBool(FunctionCall2(&state->sortOpFn,
+ rtup->val, ltup->val)))
+ return 1; /* a > b */
+ return 0;
}
}
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: valid.h,v 1.21 2000/05/28 17:56:14 tgl Exp $
+ * $Id: valid.h,v 1.22 2000/05/30 04:24:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
macro below */ \
bool __isnull; \
Datum __atp; \
- int __test; \
+ Datum __test; \
int __cur_nkeys = (nkeys); \
ScanKey __cur_keys = (keys); \
\
for (; __cur_nkeys--; __cur_keys++) \
{ \
__atp = heap_getattr((tuple), \
- __cur_keys->sk_attno, \
- (tupdesc), \
- &__isnull); \
+ __cur_keys->sk_attno, \
+ (tupdesc), \
+ &__isnull); \
\
if (__isnull) \
{ \
break; \
} \
\
- if (__cur_keys->sk_func.fn_addr == (PGFunction) oideq) /* optimization */ \
- __test = (__cur_keys->sk_argument == __atp); \
- else if (__cur_keys->sk_flags & SK_COMMUTE) \
- __test = (long) FMGR_PTR2(&__cur_keys->sk_func, \
- __cur_keys->sk_argument, __atp); \
+ if (__cur_keys->sk_flags & SK_COMMUTE) \
+ __test = FunctionCall2(&__cur_keys->sk_func, \
+ __cur_keys->sk_argument, __atp); \
else \
- __test = (long) FMGR_PTR2(&__cur_keys->sk_func, \
- __atp, __cur_keys->sk_argument); \
+ __test = FunctionCall2(&__cur_keys->sk_func, \
+ __atp, __cur_keys->sk_argument); \
\
- if (!__test == !(__cur_keys->sk_flags & SK_NEGATE)) \
+ if (DatumGetBool(__test) == !!(__cur_keys->sk_flags & SK_NEGATE)) \
{ \
/* XXX eventually should check if SK_ISNULL */ \
(result) = false; \
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_aggregate.h,v 1.25 2000/04/12 17:16:27 momjian Exp $
+ * $Id: pg_aggregate.h,v 1.26 2000/05/30 04:24:55 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
char *aggtransfn2typeName,
char *agginitval1,
char *agginitval2);
-extern char *AggNameGetInitVal(char *aggName, Oid basetype,
- int xfuncno, bool *isNull);
+
+extern Datum AggNameGetInitVal(char *aggName, Oid basetype,
+ int xfuncno, bool *isNull);
#endif /* PG_AGGREGATE_H */
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: fmgr.h,v 1.2 2000/05/29 01:59:09 tgl Exp $
+ * $Id: fmgr.h,v 1.3 2000/05/30 04:24:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
typedef char *((*func_ptr) ());
#endif
+#if 0
+
typedef struct {
char *data[FUNC_MAX_ARGS];
} FmgrValues;
* Macros for calling through the result of fmgr_info.
*/
-/* We don't make this static so fmgr_faddr() macros can access it */
+/* We don't make this static so fmgr_faddr() macro can access it */
extern FmgrInfo *fmgr_pl_finfo;
#define fmgr_faddr(finfo) (fmgr_pl_finfo = (finfo), (func_ptr) fmgr_faddr_link)
-#define FMGR_PTR2(FINFO, ARG1, ARG2) ((*(fmgr_faddr(FINFO))) (ARG1, ARG2))
-
-/*
- * Flags for the builtin oprrest selectivity routines.
- * XXX These do not belong here ... put 'em in some planner/optimizer header.
- */
-#define SEL_CONSTANT 1 /* operator's non-var arg is a constant */
-#define SEL_RIGHT 2 /* operator's non-var arg is on the right */
+#endif
#endif /* FMGR_H */
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: clauses.h,v 1.36 2000/04/12 17:16:41 momjian Exp $
+ * $Id: clauses.h,v 1.37 2000/05/30 04:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "nodes/relation.h"
+/*
+ * Flag bits returned by get_relattval().
+ * These are used in selectivity-estimation routines, too.
+ */
+#define SEL_CONSTANT 1 /* operator's non-var arg is a constant */
+#define SEL_RIGHT 2 /* operator's non-var arg is on the right */
+
+
extern Expr *make_clause(int type, Node *oper, List *args);
extern bool is_opclause(Node *clause);
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.9 2000/05/29 21:25:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.10 2000/05/30 04:24:57 tgl Exp $
*
**********************************************************************/
{
char *tmp;
- tmp = (*fmgr_faddr(&(desc->arg_out_func[i])))
- (fcinfo->arg[i],
- desc->arg_out_elem[i],
- desc->arg_out_len[i]);
+ tmp = DatumGetCString(FunctionCall3(&(desc->arg_out_func[i]),
+ fcinfo->arg[i],
+ ObjectIdGetDatum(desc->arg_out_elem[i]),
+ Int32GetDatum(desc->arg_out_len[i])));
XPUSHs(sv_2mortal(newSVpv(tmp, 0)));
pfree(tmp);
}
************************************************************/
modnulls[attnum - 1] = ' ';
fmgr_info(typinput, &finfo);
- modvalues[attnum - 1] = (Datum) (*fmgr_faddr(&finfo))
- (ret_values[i++],
- typelem,
- (!VARLENA_FIXED_SIZE(tupdesc->attrs[attnum - 1]))
- ? tupdesc->attrs[attnum - 1]->attlen
- : tupdesc->attrs[attnum - 1]->atttypmod
- );
+ modvalues[attnum - 1] =
+ FunctionCall3(&finfo,
+ CStringGetDatum(ret_values[i++]),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[attnum-1]->atttypmod));
}
************************************************************/
for (j = 0; j < callnargs; j++)
{
- qdesc->argvalues[j] = (Datum) (*fmgr_faddr(&qdesc->arginfuncs[j]))
- (callargs[j],
- qdesc->argtypelems[j],
- qdesc->arglen[j]);
+ qdesc->argvalues[j] =
+ FunctionCall3(&qdesc->arginfuncs[j],
+ CStringGetDatum(callargs[j]),
+ ObjectIdGetDatum(qdesc->argtypelems[j]),
+ Int32GetDatum(qdesc->arglen[j]));
}
/************************************************************
************************************************************/
if (!isnull && OidIsValid(typoutput))
{
- FmgrInfo finfo;
-
- fmgr_info(typoutput, &finfo);
-
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
-
+ outputstr = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[i]->attlen)));
Tcl_SetVar2(interp, *arrptr, *nameptr, outputstr, 0);
pfree(outputstr);
}
************************************************************/
if (!isnull && OidIsValid(typoutput))
{
- FmgrInfo finfo;
-
- fmgr_info(typoutput, &finfo);
-
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
-
+ outputstr = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[i]->attlen)));
sv_catpvf(output, "'%s' => '%s',", attname, outputstr);
pfree(outputstr);
}
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.22 2000/05/28 17:56:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.23 2000/05/30 04:24:58 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typoutput, &finfo_output);
- extval = (char *) (*fmgr_faddr(&finfo_output))
- (var->value,
- typeStruct->typelem,
- var->datatype->atttypmod);
+ extval = DatumGetCString(FunctionCall3(&finfo_output,
+ var->value,
+ ObjectIdGetDatum(typeStruct->typelem),
+ Int32GetDatum(var->datatype->atttypmod)));
}
plpgsql_dstring_append(&ds, extval);
break;
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typoutput, &finfo_output);
- extval = (char *) (*fmgr_faddr(&finfo_output))
- (value,
- typeStruct->typelem,
- -1);
- value = (Datum) (*fmgr_faddr(reqinput)) (extval,
- reqtypelem,
- reqtypmod);
+ extval = DatumGetCString(FunctionCall3(&finfo_output,
+ value,
+ ObjectIdGetDatum(typeStruct->typelem),
+ Int32GetDatum(-1)));
+ value = FunctionCall3(reqinput,
+ CStringGetDatum(extval),
+ ObjectIdGetDatum(reqtypelem),
+ Int32GetDatum(reqtypmod));
pfree(extval);
}
}
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.24 2000/05/29 01:59:15 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.25 2000/05/30 04:24:59 tgl Exp $
*
**********************************************************************/
{
char *tmp;
- tmp = (*fmgr_faddr(&(prodesc->arg_out_func[i])))
- (fcinfo->arg[i],
- prodesc->arg_out_elem[i],
- prodesc->arg_out_len[i]);
+ tmp = DatumGetCString(FunctionCall3(&prodesc->arg_out_func[i],
+ fcinfo->arg[i],
+ ObjectIdGetDatum(prodesc->arg_out_elem[i]),
+ Int32GetDatum(prodesc->arg_out_len[i])));
Tcl_DStringAppendElement(&tcl_cmd, tmp);
pfree(tmp);
}
/************************************************************
* Convert the result value from the safe interpreter
* into its PostgreSQL data format and return it.
- * Again, the call to fmgr() could fire an elog and we
+ * Again, the function call could fire an elog and we
* have to count for the current interpreter level we are
* on. The save_restart from above is still good.
************************************************************/
************************************************************/
modnulls[attnum - 1] = ' ';
fmgr_info(typinput, &finfo);
- modvalues[attnum - 1] = (Datum) (*fmgr_faddr(&finfo))
- (ret_values[i++],
- typelem,
- tupdesc->attrs[attnum - 1]->atttypmod);
+ modvalues[attnum - 1] =
+ FunctionCall3(&finfo,
+ CStringGetDatum(ret_values[i++]),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[attnum-1]->atttypmod));
}
-
rettup = SPI_modifytuple(trigdata->tg_relation, rettup, tupdesc->natts,
modattrs, modvalues, modnulls);
************************************************************/
for (j = 0; j < callnargs; j++)
{
- qdesc->argvalues[j] = (Datum) (*fmgr_faddr(&qdesc->arginfuncs[j]))
- (callargs[j],
- qdesc->argtypelems[j],
- qdesc->arglen[j]);
+ qdesc->argvalues[j] =
+ FunctionCall3(&qdesc->arginfuncs[j],
+ CStringGetDatum(callargs[j]),
+ ObjectIdGetDatum(qdesc->argtypelems[j]),
+ Int32GetDatum(qdesc->arglen[j]));
}
/************************************************************
************************************************************/
if (!isnull && OidIsValid(typoutput))
{
- FmgrInfo finfo;
-
- fmgr_info(typoutput, &finfo);
-
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
-
+ outputstr = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[i]->attlen)));
Tcl_SetVar2(interp, *arrptr, *nameptr, outputstr, 0);
pfree(outputstr);
}
************************************************************/
if (!isnull && OidIsValid(typoutput))
{
- FmgrInfo finfo;
-
- fmgr_info(typoutput, &finfo);
-
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
-
+ outputstr = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[i]->attlen)));
Tcl_DStringAppendElement(retval, attname);
Tcl_DStringAppendElement(retval, outputstr);
pfree(outputstr);