summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r--src/backend/utils/cache/lsyscache.c8
-rw-r--r--src/backend/utils/cache/relcache.c25
2 files changed, 10 insertions, 23 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 70872f56c7b..76e39ca8af7 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.155 2008/01/01 19:45:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.156 2008/03/25 22:42:44 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -1971,8 +1971,7 @@ get_typdefault(Oid typid)
if (!isNull)
{
/* We have an expression default */
- expr = stringToNode(DatumGetCString(DirectFunctionCall1(textout,
- datum)));
+ expr = stringToNode(TextDatumGetCString(datum));
}
else
{
@@ -1987,8 +1986,7 @@ get_typdefault(Oid typid)
char *strDefaultVal;
/* Convert text datum to C string */
- strDefaultVal = DatumGetCString(DirectFunctionCall1(textout,
- datum));
+ strDefaultVal = TextDatumGetCString(datum);
/* Convert C string to a value of the given type */
datum = OidInputFunctionCall(type->typinput, strDefaultVal,
getTypeIOParam(typeTuple), -1);
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index ca4305c60ba..e6f7eef8005 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.267 2008/02/27 17:44:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.268 2008/03/25 22:42:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -642,7 +642,6 @@ RelationBuildRuleLock(Relation relation)
Form_pg_rewrite rewrite_form = (Form_pg_rewrite) GETSTRUCT(rewrite_tuple);
bool isnull;
Datum rule_datum;
- text *rule_text;
char *rule_str;
RewriteRule *rule;
@@ -667,30 +666,22 @@ RelationBuildRuleLock(Relation relation)
rewrite_tupdesc,
&isnull);
Assert(!isnull);
- rule_text = DatumGetTextP(rule_datum);
- rule_str = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(rule_text)));
+ rule_str = TextDatumGetCString(rule_datum);
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->actions = (List *) stringToNode(rule_str);
MemoryContextSwitchTo(oldcxt);
pfree(rule_str);
- if ((Pointer) rule_text != DatumGetPointer(rule_datum))
- pfree(rule_text);
rule_datum = heap_getattr(rewrite_tuple,
Anum_pg_rewrite_ev_qual,
rewrite_tupdesc,
&isnull);
Assert(!isnull);
- rule_text = DatumGetTextP(rule_datum);
- rule_str = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(rule_text)));
+ rule_str = TextDatumGetCString(rule_datum);
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->qual = (Node *) stringToNode(rule_str);
MemoryContextSwitchTo(oldcxt);
pfree(rule_str);
- if ((Pointer) rule_text != DatumGetPointer(rule_datum))
- pfree(rule_text);
/*
* We want the rule's table references to be checked as though by the
@@ -2770,8 +2761,7 @@ AttrDefaultFetch(Relation relation)
RelationGetRelationName(relation));
else
attrdef[i].adbin = MemoryContextStrdup(CacheMemoryContext,
- DatumGetCString(DirectFunctionCall1(textout,
- val)));
+ TextDatumGetCString(val));
break;
}
@@ -2834,8 +2824,7 @@ CheckConstraintFetch(Relation relation)
RelationGetRelationName(relation));
check[found].ccbin = MemoryContextStrdup(CacheMemoryContext,
- DatumGetCString(DirectFunctionCall1(textout,
- val)));
+ TextDatumGetCString(val));
found++;
}
@@ -3068,7 +3057,7 @@ RelationGetIndexExpressions(Relation relation)
GetPgIndexDescriptor(),
&isnull);
Assert(!isnull);
- exprsString = DatumGetCString(DirectFunctionCall1(textout, exprsDatum));
+ exprsString = TextDatumGetCString(exprsDatum);
result = (List *) stringToNode(exprsString);
pfree(exprsString);
@@ -3135,7 +3124,7 @@ RelationGetIndexPredicate(Relation relation)
GetPgIndexDescriptor(),
&isnull);
Assert(!isnull);
- predString = DatumGetCString(DirectFunctionCall1(textout, predDatum));
+ predString = TextDatumGetCString(predDatum);
result = (List *) stringToNode(predString);
pfree(predString);