mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +03:00
Update textin() and textout() to new fmgr style. This is just phase
one of updating the whole text datatype, but there are so dang many calls of these two routines that it seems worth a separate commit.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* formatting.c
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.18 2000/07/03 23:09:50 wieck Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.19 2000/07/05 23:11:35 tgl Exp $
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
|
||||
@@ -2420,8 +2420,8 @@ timestamp_to_char(PG_FUNCTION_ARGS)
|
||||
|
||||
len = VARSIZE(fmt) - VARHDRSZ;
|
||||
|
||||
if ((!len) || (TIMESTAMP_NOT_FINITE(dt)))
|
||||
return PointerGetDatum(textin(""));
|
||||
if (len <= 0 || TIMESTAMP_NOT_FINITE(dt))
|
||||
return DirectFunctionCall1(textin, CStringGetDatum(""));
|
||||
|
||||
ZERO_tm(tm);
|
||||
tzn = NULL;
|
||||
@@ -3956,13 +3956,11 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
|
||||
#define NUM_TOCHAR_prepare \
|
||||
do { \
|
||||
len = VARSIZE(fmt) - VARHDRSZ; \
|
||||
\
|
||||
if (len <= 0) \
|
||||
return PointerGetDatum(textin("")); \
|
||||
\
|
||||
return DirectFunctionCall1(textin, CStringGetDatum("")); \
|
||||
result = (text *) palloc( (len * NUM_MAX_ITEM_SIZ) + 1 + VARHDRSZ); \
|
||||
format = NUM_cache(len, &Num, VARDATA(fmt), &flag); \
|
||||
} while(0)
|
||||
} while (0)
|
||||
|
||||
/* ----------
|
||||
* MACRO: Finish part of NUM
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.30 2000/01/26 05:57:14 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.31 2000/07/05 23:11:35 tgl Exp $
|
||||
*
|
||||
* Alistair Crooks added the code for the regex caching
|
||||
* agc - cached the regular expressions used - there's a good chance
|
||||
@@ -68,7 +68,8 @@ RE_compile_and_execute(struct varlena * text_re, char *text, int cflags)
|
||||
char *re;
|
||||
int regcomp_result;
|
||||
|
||||
re = textout(text_re);
|
||||
re = DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(text_re)));
|
||||
/* find a previously compiled regular expression */
|
||||
for (i = 0; i < rec; i++)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.73 2000/06/15 03:32:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.74 2000/07/05 23:11:35 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -442,7 +442,7 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype)
|
||||
|
||||
/* the right-hand const is type text for all supported operators */
|
||||
Assert(rtype == TEXTOID);
|
||||
patt = textout((text *) DatumGetPointer(value));
|
||||
patt = DatumGetCString(DirectFunctionCall1(textout, value));
|
||||
|
||||
/* divide pattern into fixed prefix and remainder */
|
||||
pstatus = pattern_fixed_prefix(patt, ptype, &prefix, &rest);
|
||||
@@ -1184,9 +1184,9 @@ getattstatistics(Oid relid,
|
||||
*/
|
||||
if (commonval)
|
||||
{
|
||||
text *val = (text *) SysCacheGetAttr(STATRELID, tuple,
|
||||
Datum val = SysCacheGetAttr(STATRELID, tuple,
|
||||
Anum_pg_statistic_stacommonval,
|
||||
&isnull);
|
||||
&isnull);
|
||||
|
||||
if (isnull)
|
||||
{
|
||||
@@ -1195,7 +1195,8 @@ getattstatistics(Oid relid,
|
||||
}
|
||||
else
|
||||
{
|
||||
char *strval = textout(val);
|
||||
char *strval = DatumGetCString(DirectFunctionCall1(textout,
|
||||
val));
|
||||
|
||||
*commonval = FunctionCall3(&inputproc,
|
||||
CStringGetDatum(strval),
|
||||
@@ -1207,9 +1208,9 @@ getattstatistics(Oid relid,
|
||||
|
||||
if (loval)
|
||||
{
|
||||
text *val = (text *) SysCacheGetAttr(STATRELID, tuple,
|
||||
Anum_pg_statistic_staloval,
|
||||
&isnull);
|
||||
Datum val = SysCacheGetAttr(STATRELID, tuple,
|
||||
Anum_pg_statistic_staloval,
|
||||
&isnull);
|
||||
|
||||
if (isnull)
|
||||
{
|
||||
@@ -1218,7 +1219,8 @@ getattstatistics(Oid relid,
|
||||
}
|
||||
else
|
||||
{
|
||||
char *strval = textout(val);
|
||||
char *strval = DatumGetCString(DirectFunctionCall1(textout,
|
||||
val));
|
||||
|
||||
*loval = FunctionCall3(&inputproc,
|
||||
CStringGetDatum(strval),
|
||||
@@ -1230,9 +1232,9 @@ getattstatistics(Oid relid,
|
||||
|
||||
if (hival)
|
||||
{
|
||||
text *val = (text *) SysCacheGetAttr(STATRELID, tuple,
|
||||
Anum_pg_statistic_stahival,
|
||||
&isnull);
|
||||
Datum val = SysCacheGetAttr(STATRELID, tuple,
|
||||
Anum_pg_statistic_stahival,
|
||||
&isnull);
|
||||
|
||||
if (isnull)
|
||||
{
|
||||
@@ -1241,7 +1243,8 @@ getattstatistics(Oid relid,
|
||||
}
|
||||
else
|
||||
{
|
||||
char *strval = textout(val);
|
||||
char *strval = DatumGetCString(DirectFunctionCall1(textout,
|
||||
val));
|
||||
|
||||
*hival = FunctionCall3(&inputproc,
|
||||
CStringGetDatum(strval),
|
||||
@@ -1868,7 +1871,6 @@ find_operator(const char *opname, Oid datatype)
|
||||
static Datum
|
||||
string_to_datum(const char *str, Oid datatype)
|
||||
{
|
||||
|
||||
/*
|
||||
* We cheat a little by assuming that textin() will do for bpchar and
|
||||
* varchar constants too...
|
||||
@@ -1876,7 +1878,7 @@ string_to_datum(const char *str, Oid datatype)
|
||||
if (datatype == NAMEOID)
|
||||
return PointerGetDatum(namein((char *) str));
|
||||
else
|
||||
return PointerGetDatum(textin((char *) str));
|
||||
return DirectFunctionCall1(textin, CStringGetDatum(str));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.20 2000/06/09 01:11:09 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.21 2000/07/05 23:11:35 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* input routine largely stolen from boxin().
|
||||
@@ -126,38 +126,6 @@ tidne(ItemPointer arg1, ItemPointer arg2)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NOT_USED
|
||||
text *
|
||||
tid_text(ItemPointer tid)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (!tid)
|
||||
return (text *) NULL;
|
||||
str = tidout(tid);
|
||||
|
||||
return textin(str);
|
||||
} /* tid_text() */
|
||||
#endif
|
||||
|
||||
#ifdef NOT_USED
|
||||
ItemPointer
|
||||
text_tid(const text *string)
|
||||
{
|
||||
ItemPointer result;
|
||||
char *str;
|
||||
|
||||
if (!string)
|
||||
return (ItemPointer) 0;
|
||||
|
||||
str = textout((text *) string);
|
||||
result = tidin(str);
|
||||
pfree(str);
|
||||
|
||||
return result;
|
||||
} /* text_tid() */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Functions to get latest tid of a specified tuple.
|
||||
*
|
||||
@@ -197,7 +165,8 @@ currtid_byrelname(PG_FUNCTION_ARGS)
|
||||
char *str;
|
||||
Relation rel;
|
||||
|
||||
str = textout(relname);
|
||||
str = DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(relname)));
|
||||
|
||||
result = (ItemPointer) palloc(sizeof(ItemPointerData));
|
||||
ItemPointerSetInvalid(result);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.31 2000/07/03 23:09:53 wieck Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.32 2000/07/05 23:11:35 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1487,7 +1487,9 @@ timestamp_trunc(PG_FUNCTION_ARGS)
|
||||
*tm = &tt;
|
||||
|
||||
if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
|
||||
elog(ERROR, "Interval units '%s' not recognized", textout(units));
|
||||
elog(ERROR, "Interval units '%s' not recognized",
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(units))));
|
||||
up = VARDATA(units);
|
||||
lp = lowunits;
|
||||
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
|
||||
@@ -1625,7 +1627,9 @@ interval_trunc(PG_FUNCTION_ARGS)
|
||||
result = (Interval *) palloc(sizeof(Interval));
|
||||
|
||||
if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
|
||||
elog(ERROR, "Interval units '%s' not recognized", textout(units));
|
||||
elog(ERROR, "Interval units '%s' not recognized",
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(units))));
|
||||
up = VARDATA(units);
|
||||
lp = lowunits;
|
||||
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
|
||||
@@ -1706,7 +1710,9 @@ interval_trunc(PG_FUNCTION_ARGS)
|
||||
#endif
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Interval units '%s' not recognized", textout(units));
|
||||
elog(ERROR, "Interval units '%s' not recognized",
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(units))));
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
@@ -1738,7 +1744,9 @@ timestamp_part(PG_FUNCTION_ARGS)
|
||||
*tm = &tt;
|
||||
|
||||
if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
|
||||
elog(ERROR, "Interval units '%s' not recognized", textout(units));
|
||||
elog(ERROR, "Interval units '%s' not recognized",
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(units))));
|
||||
up = VARDATA(units);
|
||||
lp = lowunits;
|
||||
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
|
||||
@@ -1926,7 +1934,9 @@ interval_part(PG_FUNCTION_ARGS)
|
||||
*tm = &tt;
|
||||
|
||||
if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
|
||||
elog(ERROR, "Interval units '%s' not recognized", textout(units));
|
||||
elog(ERROR, "Interval units '%s' not recognized",
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(units))));
|
||||
up = VARDATA(units);
|
||||
lp = lowunits;
|
||||
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
|
||||
@@ -2000,7 +2010,8 @@ interval_part(PG_FUNCTION_ARGS)
|
||||
|
||||
default:
|
||||
elog(ERROR, "Interval units '%s' not yet supported",
|
||||
textout(units));
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(units))));
|
||||
result = 0;
|
||||
}
|
||||
|
||||
@@ -2022,7 +2033,9 @@ interval_part(PG_FUNCTION_ARGS)
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Interval units '%s' not recognized", textout(units));
|
||||
elog(ERROR, "Interval units '%s' not recognized",
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(units))));
|
||||
result = 0;
|
||||
}
|
||||
|
||||
@@ -2056,7 +2069,9 @@ timestamp_zone(PG_FUNCTION_ARGS)
|
||||
int len;
|
||||
|
||||
if (VARSIZE(zone) - VARHDRSZ > MAXDATELEN)
|
||||
elog(ERROR, "Time zone '%s' not recognized", textout(zone));
|
||||
elog(ERROR, "Time zone '%s' not recognized",
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(zone))));
|
||||
up = VARDATA(zone);
|
||||
lp = lowzone;
|
||||
for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.61 2000/07/03 23:09:54 wieck Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.62 2000/07/05 23:11:35 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -146,54 +146,46 @@ byteaout(bytea *vlena)
|
||||
/*
|
||||
* textin - converts "..." to internal representation
|
||||
*/
|
||||
text *
|
||||
textin(char *inputText)
|
||||
Datum
|
||||
textin(PG_FUNCTION_ARGS)
|
||||
{
|
||||
char *inputText = PG_GETARG_CSTRING(0);
|
||||
text *result;
|
||||
int len;
|
||||
|
||||
if (inputText == NULL)
|
||||
return NULL;
|
||||
|
||||
len = strlen(inputText) + VARHDRSZ;
|
||||
result = (text *) palloc(len);
|
||||
VARATT_SIZEP(result) = len;
|
||||
|
||||
memmove(VARDATA(result), inputText, len - VARHDRSZ);
|
||||
memcpy(VARDATA(result), inputText, len - VARHDRSZ);
|
||||
|
||||
#ifdef CYR_RECODE
|
||||
convertstr(VARDATA(result), len - VARHDRSZ, 0);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
PG_RETURN_TEXT_P(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* textout - converts internal representation to "..."
|
||||
*/
|
||||
char *
|
||||
textout(text *vlena)
|
||||
Datum
|
||||
textout(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *t = PG_GETARG_TEXT_P(0);
|
||||
int len;
|
||||
char *result;
|
||||
|
||||
if (vlena == NULL)
|
||||
{
|
||||
result = (char *) palloc(2);
|
||||
result[0] = '-';
|
||||
result[1] = '\0';
|
||||
return result;
|
||||
}
|
||||
len = VARSIZE(vlena) - VARHDRSZ;
|
||||
len = VARSIZE(t) - VARHDRSZ;
|
||||
result = (char *) palloc(len + 1);
|
||||
memmove(result, VARDATA(vlena), len);
|
||||
memcpy(result, VARDATA(t), len);
|
||||
result[len] = '\0';
|
||||
|
||||
#ifdef CYR_RECODE
|
||||
convertstr(result, len, 1);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
PG_RETURN_CSTRING(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
24
src/backend/utils/cache/fcache.c
vendored
24
src/backend/utils/cache/fcache.c
vendored
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.32 2000/06/06 17:44:25 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.33 2000/07/05 23:11:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ init_fcache(Oid foid,
|
||||
Form_pg_type typeStruct;
|
||||
FunctionCachePtr retval;
|
||||
int nargs;
|
||||
text *tmp;
|
||||
Datum tmp;
|
||||
bool isNull;
|
||||
|
||||
retval = (FunctionCachePtr) palloc(sizeof(FunctionCache));
|
||||
@@ -212,14 +212,14 @@ init_fcache(Oid foid,
|
||||
|
||||
if (procedureStruct->prolang == SQLlanguageId)
|
||||
{
|
||||
tmp = (text *) SysCacheGetAttr(PROCOID,
|
||||
procedureTuple,
|
||||
Anum_pg_proc_prosrc,
|
||||
&isNull);
|
||||
tmp = SysCacheGetAttr(PROCOID,
|
||||
procedureTuple,
|
||||
Anum_pg_proc_prosrc,
|
||||
&isNull);
|
||||
if (isNull)
|
||||
elog(ERROR, "init_fcache: null prosrc for procedure %u",
|
||||
foid);
|
||||
retval->src = textout(tmp);
|
||||
retval->src = DatumGetCString(DirectFunctionCall1(textout, tmp));
|
||||
retval->bin = (char *) NULL;
|
||||
}
|
||||
else
|
||||
@@ -229,14 +229,14 @@ init_fcache(Oid foid,
|
||||
retval->bin = (char *) NULL;
|
||||
else
|
||||
{
|
||||
tmp = (text *) SysCacheGetAttr(PROCOID,
|
||||
procedureTuple,
|
||||
Anum_pg_proc_probin,
|
||||
&isNull);
|
||||
tmp = SysCacheGetAttr(PROCOID,
|
||||
procedureTuple,
|
||||
Anum_pg_proc_probin,
|
||||
&isNull);
|
||||
if (isNull)
|
||||
elog(ERROR, "init_fcache: null probin for procedure %u",
|
||||
foid);
|
||||
retval->bin = textout(tmp);
|
||||
retval->bin = DatumGetCString(DirectFunctionCall1(textout, tmp));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
24
src/backend/utils/cache/relcache.c
vendored
24
src/backend/utils/cache/relcache.c
vendored
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.105 2000/06/30 07:04:10 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.106 2000/07/05 23:11:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1901,7 +1901,7 @@ AttrDefaultFetch(Relation relation)
|
||||
IndexScanDesc sd = (IndexScanDesc) NULL;
|
||||
HeapScanDesc adscan = (HeapScanDesc) NULL;
|
||||
RetrieveIndexResult indexRes;
|
||||
struct varlena *val;
|
||||
Datum val;
|
||||
bool isnull;
|
||||
int found;
|
||||
int i;
|
||||
@@ -1959,16 +1959,17 @@ AttrDefaultFetch(Relation relation)
|
||||
NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
|
||||
RelationGetRelationName(relation));
|
||||
|
||||
val = (struct varlena *) fastgetattr(htup,
|
||||
Anum_pg_attrdef_adbin,
|
||||
adrel->rd_att, &isnull);
|
||||
val = fastgetattr(htup,
|
||||
Anum_pg_attrdef_adbin,
|
||||
adrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
elog(NOTICE, "AttrDefaultFetch: adbin IS NULL for attr %s in rel %s",
|
||||
NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
|
||||
RelationGetRelationName(relation));
|
||||
else
|
||||
attrdef[i].adbin = MemoryContextStrdup(CacheMemoryContext,
|
||||
textout(val));
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
val)));
|
||||
break;
|
||||
}
|
||||
if (hasindex)
|
||||
@@ -2008,7 +2009,7 @@ RelCheckFetch(Relation relation)
|
||||
HeapScanDesc rcscan = (HeapScanDesc) NULL;
|
||||
RetrieveIndexResult indexRes;
|
||||
Name rcname;
|
||||
struct varlena *val;
|
||||
Datum val;
|
||||
bool isnull;
|
||||
int found;
|
||||
bool hasindex;
|
||||
@@ -2066,14 +2067,15 @@ RelCheckFetch(Relation relation)
|
||||
RelationGetRelationName(relation));
|
||||
check[found].ccname = MemoryContextStrdup(CacheMemoryContext,
|
||||
NameStr(*rcname));
|
||||
val = (struct varlena *) fastgetattr(htup,
|
||||
Anum_pg_relcheck_rcbin,
|
||||
rcrel->rd_att, &isnull);
|
||||
val = fastgetattr(htup,
|
||||
Anum_pg_relcheck_rcbin,
|
||||
rcrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
|
||||
RelationGetRelationName(relation));
|
||||
check[found].ccbin = MemoryContextStrdup(CacheMemoryContext,
|
||||
textout(val));
|
||||
DatumGetCString(DirectFunctionCall1(textout,
|
||||
val)));
|
||||
found++;
|
||||
if (hasindex)
|
||||
ReleaseBuffer(buffer);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.43 2000/06/28 03:32:31 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.44 2000/07/05 23:11:40 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -71,21 +71,17 @@ fmgr_dynamic(Oid functionId)
|
||||
|
||||
prosrcattr = SysCacheGetAttr(PROCOID, procedureTuple,
|
||||
Anum_pg_proc_prosrc, &isnull);
|
||||
if (isnull || !PointerIsValid(prosrcattr))
|
||||
{
|
||||
if (isnull)
|
||||
elog(ERROR, "fmgr: Could not extract prosrc for %u from pg_proc",
|
||||
functionId);
|
||||
}
|
||||
prosrcstring = textout((text *) DatumGetPointer(prosrcattr));
|
||||
prosrcstring = DatumGetCString(DirectFunctionCall1(textout, prosrcattr));
|
||||
|
||||
probinattr = SysCacheGetAttr(PROCOID, procedureTuple,
|
||||
Anum_pg_proc_probin, &isnull);
|
||||
if (isnull || !PointerIsValid(probinattr))
|
||||
{
|
||||
if (isnull)
|
||||
elog(ERROR, "fmgr: Could not extract probin for %u from pg_proc",
|
||||
functionId);
|
||||
}
|
||||
probinstring = textout((text *) DatumGetPointer(probinattr));
|
||||
probinstring = DatumGetCString(DirectFunctionCall1(textout, probinattr));
|
||||
|
||||
user_fn = load_external_function(probinstring, prosrcstring);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.43 2000/06/05 07:28:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.44 2000/07/05 23:11:40 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -164,7 +164,8 @@ fmgr_info(Oid functionId, FmgrInfo *finfo)
|
||||
* stored in prosrc (it doesn't have to be the same as the
|
||||
* name of the alias!)
|
||||
*/
|
||||
prosrc = textout(&(procedureStruct->prosrc));
|
||||
prosrc = DatumGetCString(DirectFunctionCall1(textout,
|
||||
PointerGetDatum(&procedureStruct->prosrc)));
|
||||
fbp = fmgr_lookupByName(prosrc);
|
||||
if (fbp == NULL)
|
||||
elog(ERROR, "fmgr_info: function %s not in internal table",
|
||||
|
||||
Reference in New Issue
Block a user