]> granicus.if.org Git - postgresql/commitdiff
Update textin() and textout() to new fmgr style. This is just phase
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 5 Jul 2000 23:12:09 +0000 (23:12 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 5 Jul 2000 23:12:09 +0000 (23:12 +0000)
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.

39 files changed:
contrib/spi/autoinc.c
contrib/spi/insert_username.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_type.c
src/backend/commands/analyze.c
src/backend/commands/command.c
src/backend/commands/comment.c
src/backend/commands/copy.c
src/backend/commands/dbcommands.c
src/backend/commands/indexcmds.c
src/backend/commands/proclang.c
src/backend/commands/sequence.c
src/backend/commands/user.c
src/backend/executor/execUtils.c
src/backend/libpq/be-pqexec.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/util/plancat.c
src/backend/parser/parse_coerce.c
src/backend/parser/parse_node.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/regexp.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/tid.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/varlena.c
src/backend/utils/cache/fcache.c
src/backend/utils/cache/relcache.c
src/backend/utils/fmgr/dfmgr.c
src/backend/utils/fmgr/fmgr.c
src/include/catalog/pg_proc.h
src/include/utils/builtins.h
src/pl/plperl/plperl.c
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/tcl/pltcl.c
src/test/regress/regress.c

index 804e1d63838dbb9b12b616bd98de3d9785cff299..f8b86217e73b79115cef4017d32a4d013246dc12 100644 (file)
@@ -53,12 +53,13 @@ autoinc(PG_FUNCTION_ARGS)
 
        for (i = 0; i < nargs;)
        {
-               text       *seqname;
                int                     attnum = SPI_fnumber(tupdesc, args[i]);
                int32           val;
+               Datum           seqname;
 
                if (attnum < 0)
-                       elog(ERROR, "autoinc (%s): there is no attribute %s", relname, args[i]);
+                       elog(ERROR, "autoinc (%s): there is no attribute %s",
+                                relname, args[i]);
                if (SPI_gettypeid(tupdesc, attnum) != INT4OID)
                        elog(ERROR, "autoinc (%s): attribute %s must be of INT4 type",
                                 relname, args[i]);
@@ -73,13 +74,12 @@ autoinc(PG_FUNCTION_ARGS)
 
                i++;
                chattrs[chnattrs] = attnum;
-               seqname = textin(args[i]);
-               newvals[chnattrs] = DirectFunctionCall1(nextval,
-                                                                                               PointerGetDatum(seqname));
+               seqname = DirectFunctionCall1(textin,
+                                                                         CStringGetDatum(args[i]));
+               newvals[chnattrs] = DirectFunctionCall1(nextval, seqname);
                if (DatumGetInt32(newvals[chnattrs]) == 0)
-                       newvals[chnattrs] = DirectFunctionCall1(nextval,
-                                                                                                       PointerGetDatum(seqname));
-               pfree(seqname);
+                       newvals[chnattrs] = DirectFunctionCall1(nextval, seqname);
+               pfree(DatumGetTextP(seqname));
                chnattrs++;
                i++;
        }
index 61b4150084522f506c8c7419d107caa15ac8cc98..978a873ec90dd67b7fe22009c560344b3e88d747 100644 (file)
@@ -62,7 +62,7 @@ insert_username(PG_FUNCTION_ARGS)
                         relname, args[0]);
 
        /* create fields containing name */
-       newval = PointerGetDatum(textin(GetPgUserName()));
+       newval = DirectFunctionCall1(textin, CStringGetDatum(GetPgUserName()));
 
        /* construct new tuple */
        rettuple = SPI_modifytuple(rel, rettuple, 1, &attnum, &newval, NULL);
index bd330b5d1ea51ac8d49f6a7d9d700e2a06a395df..08b5e64c53def257e5b035f1adfdf8e2d9b3391f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.138 2000/07/04 06:11:23 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.139 2000/07/05 23:11:06 tgl Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -1121,7 +1121,8 @@ RelationTruncateIndexes(Relation heapRelation)
                /* If a valid where predicate, compute predicate Node */
                if (VARSIZE(&index->indpred) != 0)
                {
-                       predString = textout(&index->indpred);
+                       predString = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                       PointerGetDatum(&index->indpred)));
                        oldPred = stringToNode(predString);
                        pfree(predString);
                }
@@ -1602,8 +1603,10 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin,
 
        values[Anum_pg_attrdef_adrelid - 1] = RelationGetRelid(rel);
        values[Anum_pg_attrdef_adnum - 1] = attnum;
-       values[Anum_pg_attrdef_adbin - 1] = PointerGetDatum(textin(adbin));
-       values[Anum_pg_attrdef_adsrc - 1] = PointerGetDatum(textin(adsrc));
+       values[Anum_pg_attrdef_adbin - 1] = DirectFunctionCall1(textin,
+                                                                                                       CStringGetDatum(adbin));
+       values[Anum_pg_attrdef_adsrc - 1] = DirectFunctionCall1(textin,
+                                                                                                       CStringGetDatum(adsrc));
        adrel = heap_openr(AttrDefaultRelationName, RowExclusiveLock);
        tuple = heap_formtuple(adrel->rd_att, values, nulls);
        heap_insert(adrel, tuple);
@@ -1685,8 +1688,10 @@ StoreRelCheck(Relation rel, char *ccname, char *ccbin)
 
        values[Anum_pg_relcheck_rcrelid - 1] = RelationGetRelid(rel);
        values[Anum_pg_relcheck_rcname - 1] = PointerGetDatum(namein(ccname));
-       values[Anum_pg_relcheck_rcbin - 1] = PointerGetDatum(textin(ccbin));
-       values[Anum_pg_relcheck_rcsrc - 1] = PointerGetDatum(textin(ccsrc));
+       values[Anum_pg_relcheck_rcbin - 1] = DirectFunctionCall1(textin,
+                                                                                                       CStringGetDatum(ccbin));
+       values[Anum_pg_relcheck_rcsrc - 1] = DirectFunctionCall1(textin,
+                                                                                                       CStringGetDatum(ccsrc));
        rcrel = heap_openr(RelCheckRelationName, RowExclusiveLock);
        tuple = heap_formtuple(rcrel->rd_att, values, nulls);
        heap_insert(rcrel, tuple);
index bedb84e6d24d1e9d77fec072353dcd9e5f0d1d03..e1909e4404ccf4da4b6581ce835cf0f2fa7de880 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.123 2000/07/05 16:17:37 wieck Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.124 2000/07/05 23:11:06 tgl Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -680,11 +680,13 @@ UpdateIndexRelation(Oid indexoid,
        if (predicate != NULL)
        {
                predString = nodeToString(predicate);
-               predText = textin(predString);
+               predText = DatumGetTextP(DirectFunctionCall1(textin,
+                                                                                       CStringGetDatum(predString)));
                pfree(predString);
        }
        else
-               predText = textin("");
+               predText = DatumGetTextP(DirectFunctionCall1(textin,
+                                                                                                        CStringGetDatum("")));
 
        predLen = VARSIZE(predText);
        itupLen = predLen + sizeof(FormData_pg_index);
@@ -824,11 +826,13 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
        if (newPred != NULL)
        {
                predString = nodeToString(newPred);
-               predText = textin(predString);
+               predText = DatumGetTextP(DirectFunctionCall1(textin,
+                                                                                       CStringGetDatum(predString)));
                pfree(predString);
        }
        else
-               predText = textin("");
+               predText = DatumGetTextP(DirectFunctionCall1(textin,
+                                                                                                        CStringGetDatum("")));
 
        /* open the index system catalog relation */
        pg_index = heap_openr(IndexRelationName, RowExclusiveLock);
@@ -1337,7 +1341,7 @@ IndexesAreActive(Oid relid, bool confirmCommitted)
                elog(ERROR, "IndexesAreActive couldn't lock %u", relid);
        if (((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_RELATION &&
            ((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_TOASTVALUE)
-               elog(ERROR, "relation %u isn't an relation", relid);
+               elog(ERROR, "relation %u isn't an indexable relation", relid);
        isactive = ((Form_pg_class) GETSTRUCT(&tuple))->relhasindex;
        ReleaseBuffer(buffer);
        if (isactive)
@@ -2080,7 +2084,8 @@ reindex_index(Oid indexId, bool force)
        /* If a valid where predicate, compute predicate Node */
        if (VARSIZE(&index->indpred) != 0)
        {
-               predString = textout(&index->indpred);
+               predString = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                       PointerGetDatum(&index->indpred)));
                oldPred = stringToNode(predString);
                pfree(predString);
        }
index 37c6a8cb41d87bbf50d47a570936e65fcec88108..f068c897ec13e732d238e572a691cd37525962e6 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.33 2000/05/30 04:24:36 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.34 2000/07/05 23:11:07 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -238,12 +238,14 @@ AggregateCreate(char *aggName,
        values[Anum_pg_aggregate_aggfinaltype - 1] = ObjectIdGetDatum(fret);
 
        if (agginitval1)
-               values[Anum_pg_aggregate_agginitval1 - 1] = PointerGetDatum(textin(agginitval1));
+               values[Anum_pg_aggregate_agginitval1 - 1] =
+                       DirectFunctionCall1(textin, CStringGetDatum(agginitval1));
        else
                nulls[Anum_pg_aggregate_agginitval1 - 1] = 'n';
 
        if (agginitval2)
-               values[Anum_pg_aggregate_agginitval2 - 1] = PointerGetDatum(textin(agginitval2));
+               values[Anum_pg_aggregate_agginitval2 - 1] =
+                       DirectFunctionCall1(textin, CStringGetDatum(agginitval2));
        else
                nulls[Anum_pg_aggregate_agginitval2 - 1] = 'n';
 
@@ -277,7 +279,7 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
        Oid                     transtype,
                                typinput,
                                typelem;
-       text       *textInitVal;
+       Datum           textInitVal;
        char       *strInitVal;
        Datum           initVal;
 
@@ -312,17 +314,15 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
                initValAttno = Anum_pg_aggregate_agginitval2;
        }
 
-       textInitVal = (text *) fastgetattr(tup, initValAttno,
-                                                                          RelationGetDescr(aggRel),
-                                                                          isNull);
-       if (!PointerIsValid(textInitVal))
-               *isNull = true;
+       textInitVal = fastgetattr(tup, initValAttno,
+                                                         RelationGetDescr(aggRel),
+                                                         isNull);
        if (*isNull)
        {
                heap_close(aggRel, AccessShareLock);
                return PointerGetDatum(NULL);
        }
-       strInitVal = textout(textInitVal);
+       strInitVal = DatumGetCString(DirectFunctionCall1(textout, textInitVal));
 
        heap_close(aggRel, AccessShareLock);
 
index e6091f6f63c749cb5dd64a79ab85f492ffc3effc..0322d982d16c24e75f759caa1970c811af8cda26 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.45 2000/06/28 03:31:23 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.46 2000/07/05 23:11:07 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -156,7 +156,8 @@ ProcedureCreate(char *procedureName,
                         */
                        text       *prosrctext;
 
-                       prosrctext = textin(prosrc);
+                       prosrctext = DatumGetTextP(DirectFunctionCall1(textin,
+                                                                                                       CStringGetDatum(prosrc)));
                        tup = SearchSysCacheTuple(PROSRC,
                                                                          PointerGetDatum(prosrctext),
                                                                          0, 0, 0);
@@ -306,8 +307,10 @@ ProcedureCreate(char *procedureName,
        values[i++] = Int32GetDatum(perbyte_cpu);       /* properbyte_cpu */
        values[i++] = Int32GetDatum(percall_cpu);       /* propercall_cpu */
        values[i++] = Int32GetDatum(outin_ratio);       /* prooutin_ratio */
-       values[i++] = (Datum) textin(prosrc);           /* prosrc */
-       values[i++] = (Datum) textin(probin);           /* probin */
+       values[i++] = DirectFunctionCall1(textin,       /* prosrc */
+                                                                         CStringGetDatum(prosrc));
+       values[i++] = DirectFunctionCall1(textin,       /* probin */
+                                                                         CStringGetDatum(probin));
 
        rel = heap_openr(ProcedureRelationName, RowExclusiveLock);
 
index bd34ee0a20061917308b6b2b68267636be0e7050..8356958d325186a008be2f0172f3a0a4b32dc886 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.53 2000/07/03 23:09:28 wieck Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.54 2000/07/05 23:11:07 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -167,32 +167,29 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
        }
 
        /* ----------------
-        *      initialize *values with the type name and
+        *      initialize *values with the type name and dummy values
         * ----------------
         */
        i = 0;
        namestrcpy(&name, typeName);
-       values[i++] = NameGetDatum(&name);      /* 1 */
-       values[i++] = (Datum) InvalidOid;       /* 2 */
-       values[i++] = (Datum) (int16) 0;        /* 3 */
-       values[i++] = (Datum) (int16) 0;        /* 4 */
-       values[i++] = (Datum) (bool) 0;         /* 5 */
-       values[i++] = (Datum) (bool) 0;         /* 6 */
-       values[i++] = (Datum) (bool) 0;         /* 7 */
-       values[i++] = (Datum) (bool) 0;         /* 8 */
-       values[i++] = (Datum) InvalidOid;       /* 9 */
-       values[i++] = (Datum) InvalidOid;       /* 10 */
-       values[i++] = (Datum) InvalidOid;       /* 11 */
-       values[i++] = (Datum) InvalidOid;       /* 12 */
-       values[i++] = (Datum) InvalidOid;       /* 13 */
-       values[i++] = (Datum) InvalidOid;       /* 14 */
-       values[i++] = (Datum) 'p';                      /* 15 */
-       values[i++] = (Datum) 'i';                      /* 16 */
-
-       /*
-        * ... and fill typdefault with a bogus value
-        */
-       values[i++] = (Datum) textin(typeName);         /* 15 */
+       values[i++] = NameGetDatum(&name);                      /* 1 */
+       values[i++] = ObjectIdGetDatum(InvalidOid);     /* 2 */
+       values[i++] = Int16GetDatum(0);                         /* 3 */
+       values[i++] = Int16GetDatum(0);                         /* 4 */
+       values[i++] = BoolGetDatum(false);                      /* 5 */
+       values[i++] = BoolGetDatum(false);                      /* 6 */
+       values[i++] = BoolGetDatum(false);                      /* 7 */
+       values[i++] = BoolGetDatum(false);                      /* 8 */
+       values[i++] = ObjectIdGetDatum(InvalidOid);     /* 9 */
+       values[i++] = ObjectIdGetDatum(InvalidOid);     /* 10 */
+       values[i++] = ObjectIdGetDatum(InvalidOid);     /* 11 */
+       values[i++] = ObjectIdGetDatum(InvalidOid);     /* 12 */
+       values[i++] = ObjectIdGetDatum(InvalidOid);     /* 13 */
+       values[i++] = ObjectIdGetDatum(InvalidOid);     /* 14 */
+       values[i++] = CharGetDatum('p');                        /* 15 */
+       values[i++] = CharGetDatum('i');                        /* 16 */
+       values[i++] = DirectFunctionCall1(textin,
+                                                                         CStringGetDatum(typeName));   /* 17 */
 
        /* ----------------
         *      create a new type tuple with FormHeapTuple
@@ -460,9 +457,8 @@ TypeCreate(char *typeName,
         *      initialize the default value for this type.
         * ----------------
         */
-       values[i] = (Datum) textin(PointerIsValid(defaultTypeValue)     /* 17 */
-                                                          ? defaultTypeValue : "-"); /* XXX default
-                                                                                                                  * typdefault */
+       values[i] = DirectFunctionCall1(textin, /* 17 */
+                               CStringGetDatum(defaultTypeValue ? defaultTypeValue : "-"));
 
        /* ----------------
         *      open pg_type and begin a scan for the type name.
index 719e20a4161f23508392bc9f4c3400ddb370be47..c584d9722091b29c1325fa377698e663d710ca2c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.2 2000/05/30 04:25:00 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.3 2000/07/05 23:11:08 tgl Exp $
  *
 
  *-------------------------------------------------------------------------
@@ -515,8 +515,8 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
                         */
                        if (VacAttrStatsLtGtValid(stats) && stats->initialized)
                        {
-                               float32data nullratio;
-                               float32data bestratio;
+                               float4          nullratio;
+                               float4          bestratio;
                                FmgrInfo        out_function;
                                char       *out_string;
                                double          best_cnt_d = stats->best_cnt,
@@ -541,26 +541,28 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
                                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++] = Float32GetDatum(&nullratio);      /* stanullfrac */
-                               values[i++] = Float32GetDatum(&bestratio);      /* stacommonfrac */
+                               values[i++] = Float4GetDatum(nullratio);        /* stanullfrac */
+                               values[i++] = Float4GetDatum(bestratio);        /* stacommonfrac */
                                out_string = DatumGetCString(FunctionCall3(&out_function,
                                                                                         stats->best,
                                                                                         ObjectIdGetDatum(stats->typelem),
                                                                                         Int32GetDatum(stats->attr->atttypmod)));
-                               values[i++] = PointerGetDatum(textin(out_string));      /* stacommonval */
+                               values[i++] = DirectFunctionCall1(textin,       /* stacommonval */
+                                                                                                 CStringGetDatum(out_string));
                                pfree(out_string);
                                out_string = DatumGetCString(FunctionCall3(&out_function,
                                                                                         stats->min,
                                                                                         ObjectIdGetDatum(stats->typelem),
                                                                                         Int32GetDatum(stats->attr->atttypmod)));
-                               values[i++] = PointerGetDatum(textin(out_string));      /* staloval */
+                               values[i++] = DirectFunctionCall1(textin,       /* staloval */
+                                                                                                 CStringGetDatum(out_string));
                                pfree(out_string);
                                out_string = DatumGetCString(FunctionCall3(&out_function,
                                                                                         stats->max,
                                                                                         ObjectIdGetDatum(stats->typelem),
                                                                                         Int32GetDatum(stats->attr->atttypmod)));
-                               values[i++] = PointerGetDatum(textin(out_string));      /* stahival */
+                               values[i++] = DirectFunctionCall1(textin,       /* stahival */
+                                                                                                 CStringGetDatum(out_string));
                                pfree(out_string);
 
                                stup = heap_formtuple(sd->rd_att, values, nulls);
index e3847ab5f4d42eb8b5b587c3266c383d00a1b1ad..6648e66f4e398f73cc7a8be56bd25f5203f7898d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.87 2000/07/05 16:17:38 wieck Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.88 2000/07/05 23:11:09 tgl Exp $
  *
  * NOTES
  *       The PerformAddAttribute() code, like most of the relation
@@ -788,7 +788,6 @@ RemoveColumnReferences(Oid reloid, int attnum, bool checkonly, HeapTuple reltup)
        HeapTuple       htup,
                                indexTuple;
        Form_pg_index index;
-       Form_pg_relcheck relcheck;
        Form_pg_class pgcform = (Form_pg_class) NULL;
        int                     i;
        bool            checkok = true;
@@ -807,13 +806,13 @@ RemoveColumnReferences(Oid reloid, int attnum, bool checkonly, HeapTuple reltup)
 
        while (HeapTupleIsValid(htup = systable_getnext(sysscan)))
        {
+               Form_pg_relcheck relcheck;
                char       *ccbin;
                Node       *node;
 
                relcheck = (Form_pg_relcheck) GETSTRUCT(htup);
-               ccbin = textout(&relcheck->rcbin);
-               if (!ccbin)
-                       continue;
+               ccbin = DatumGetCString(DirectFunctionCall1(textout,
+                                                                               PointerGetDatum(&relcheck->rcbin)));
                node = stringToNode(ccbin);
                pfree(ccbin);
                if (find_attribute_in_node(node, attnum))
@@ -1322,10 +1321,12 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
                                           BYTEAOID,
                                           -1, 0, false);
 
-       /* XXX what if owning relation is temp?  need we mark toasttable too? */
-       /* XXX How do we know? No naming collisions possible because names    */
-       /*     are OID based. And toast table disappears when master table    */
-       /*     is destroyed. So what is it good for anyway? Jan               */
+       /*
+        * Note: the toast relation is considered a "normal" relation even if
+        * its master relation is a temp table.  There cannot be any naming
+        * collision, and the toast rel will be destroyed when its master is,
+        * so there's no need to handle the toast rel as temp.
+        */
        heap_create_with_catalog(toast_relname, tupdesc, RELKIND_TOASTVALUE,
                                                         false, true);
 
@@ -1399,7 +1400,7 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
        heap_freetuple(reltup);
 
        /*
-        * Close relatons and make changes visible
+        * Close relations and make changes visible
         */
        heap_close(class_rel, NoLock);
        heap_close(rel, NoLock);
index 2b9bf4d7723ff035f1495e5db014e4626c0af0ed..c76912f332a85460a55391940bccf295fb8ff90d 100644 (file)
@@ -151,7 +151,7 @@ CreateComments(Oid oid, char *comment)
                }
                i = 0;
                values[i++] = ObjectIdGetDatum(oid);
-               values[i++] = (Datum) textin(comment);
+               values[i++] = DirectFunctionCall1(textin, CStringGetDatum(comment));
        }
 
        /*** Now, open pg_description and attempt to find the old tuple ***/
index 177b339be8cdae73677fcea0cb1af282acdb9b4b..441941762eaac5f5a13076f336f26604d942d9ec 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.116 2000/06/28 06:05:36 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.117 2000/07/05 23:11:11 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -676,7 +676,8 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim, char *null
                                indexNatts[i] = natts;
                                if (VARSIZE(&pgIndexP[i]->indpred) != 0)
                                {
-                                       predString = textout(&pgIndexP[i]->indpred);
+                                       predString = DatumGetCString(DirectFunctionCall1(textout,
+                                                                       PointerGetDatum(&pgIndexP[i]->indpred)));
                                        indexPred[i] = stringToNode(predString);
                                        pfree(predString);
                                        /* make dummy ExprContext for use by ExecQual */
index 72cfd297aa7e55ed6c6dcb1ecd66cca328405106..bda64842c49d9842e9342949e6c901f5e07ce16e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.57 2000/06/02 04:04:54 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.58 2000/07/05 23:11:11 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -101,7 +101,8 @@ createdb(const char *dbname, const char *dbpath, int encoding)
        new_record[Anum_pg_database_datname - 1] = NameGetDatum(namein(dbname));
        new_record[Anum_pg_database_datdba - 1] = Int32GetDatum(user_id);
        new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding);
-       new_record[Anum_pg_database_datpath - 1] = PointerGetDatum(textin(locbuf));
+       new_record[Anum_pg_database_datpath - 1] = DirectFunctionCall1(textin,
+                                                                                                       CStringGetDatum(locbuf));
 
        tuple = heap_formtuple(pg_database_dsc, new_record, new_record_nulls);
 
index 1446aa8844b7db9eedbf54a18b542af82059f32d..efe8a44180a7554a091b28fed77b093e83532f40 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.33 2000/07/04 06:11:27 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.34 2000/07/05 23:11:11 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -304,7 +304,8 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
        {
                char       *predString;
 
-               predString = textout(&index->indpred);
+               predString = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                       PointerGetDatum(&index->indpred)));
                oldPred = stringToNode(predString);
                pfree(predString);
        }
index 9b5f7c1ddff64a3a40e73918a41800dbfbf66307..ec8aec7005f169e3df795090322a658d2403293d 100644 (file)
@@ -117,10 +117,11 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
 
        i = 0;
        values[i++] = PointerGetDatum(languageName);
-       values[i++] = Int8GetDatum((bool) 1);
-       values[i++] = Int8GetDatum(stmt->pltrusted);
+       values[i++] = BoolGetDatum(true); /* lanispl */
+       values[i++] = BoolGetDatum(stmt->pltrusted);
        values[i++] = ObjectIdGetDatum(procTup->t_data->t_oid);
-       values[i++] = (Datum) textin(stmt->plcompiler);
+       values[i++] = DirectFunctionCall1(textin,
+                                                                         CStringGetDatum(stmt->plcompiler));
 
        rel = heap_openr(LanguageRelationName, RowExclusiveLock);
 
index 968ae569ee019e555329cd395c797826b219ebb3..80fca6a38a116bf623168e9766034be3970e54b1 100644 (file)
@@ -377,7 +377,8 @@ setval(PG_FUNCTION_ARGS)
 static char *
 get_seq_name(text *seqin)
 {
-       char       *rawname = textout(seqin);
+       char       *rawname = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                       PointerGetDatum(seqin)));
        int                     rawlen = strlen(rawname);
        char       *seqname;
 
index 9bb36311cc8d74d4023aff8635ceafac69eb5000..4698fa850c07033d2df75c3f090277ec596ff15d 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.62 2000/06/28 03:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.63 2000/07/05 23:11:11 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -121,7 +121,8 @@ write_password_file(Relation rel)
                                CRYPT_PWD_FILE_SEPSTR
                                "%s\n",
                                nameout(DatumGetName(datum_n)),
-                               null_p ? "" : textout((text *) datum_p),
+                               null_p ? "" :
+                               DatumGetCString(DirectFunctionCall1(textout, datum_p)),
                                null_v ? "\\N" :
                                DatumGetCString(DirectFunctionCall1(nabstimeout, datum_v))
                        );
@@ -257,7 +258,8 @@ CreateUser(CreateUserStmt *stmt)
        new_record[Anum_pg_shadow_usecatupd - 1] = (Datum) (stmt->createuser);
 
        if (stmt->password)
-               new_record[Anum_pg_shadow_passwd - 1] = PointerGetDatum(textin(stmt->password));
+               new_record[Anum_pg_shadow_passwd - 1] =
+                       DirectFunctionCall1(textin, CStringGetDatum(stmt->password));
        if (stmt->validUntil)
                new_record[Anum_pg_shadow_valuntil - 1] =
                        DirectFunctionCall1(nabstimein, CStringGetDatum(stmt->validUntil));
@@ -424,13 +426,15 @@ AlterUser(AlterUserStmt *stmt)
        /* password */
        if (stmt->password)
        {
-               new_record[Anum_pg_shadow_passwd - 1] = PointerGetDatum(textin(stmt->password));
+               new_record[Anum_pg_shadow_passwd - 1] =
+                       DirectFunctionCall1(textin, CStringGetDatum(stmt->password));
                new_record_nulls[Anum_pg_shadow_passwd - 1] = ' ';
        }
        else
        {
                /* leave as is */
-               new_record[Anum_pg_shadow_passwd - 1] = heap_getattr(tuple, Anum_pg_shadow_passwd, pg_shadow_dsc, &null);
+               new_record[Anum_pg_shadow_passwd - 1] =
+                       heap_getattr(tuple, Anum_pg_shadow_passwd, pg_shadow_dsc, &null);
                new_record_nulls[Anum_pg_shadow_passwd - 1] = null ? 'n' : ' ';
        }
 
@@ -444,7 +448,8 @@ AlterUser(AlterUserStmt *stmt)
        else
        {
                /* leave as is */
-               new_record[Anum_pg_shadow_valuntil - 1] = heap_getattr(tuple, Anum_pg_shadow_valuntil, pg_shadow_dsc, &null);
+               new_record[Anum_pg_shadow_valuntil - 1] =
+                       heap_getattr(tuple, Anum_pg_shadow_valuntil, pg_shadow_dsc, &null);
                new_record_nulls[Anum_pg_shadow_valuntil - 1] = null ? 'n' : ' ';
        }
 
index 3777b68e64c655bc303997d17caab0e5095e8dfa..a023405a2754be53532a77f0c1f4ba97ca75db3a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.61 2000/06/19 23:40:47 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.62 2000/07/05 23:11:14 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -850,7 +850,8 @@ ExecOpenIndices(RelationInfo *resultRelationInfo)
                {
                        char       *predString;
 
-                       predString = textout(&indexStruct->indpred);
+                       predString = DatumGetCString(DirectFunctionCall1(textout,
+                                                                       PointerGetDatum(&indexStruct->indpred)));
                        predicate = (PredInfo *) stringToNode(predString);
                        pfree(predString);
                }
index 6834f51311353b0d72a59f64fe6203ed3f944b4d..78745d50a7f30e362188051402e794d5361ed0b8 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.34 2000/07/04 06:11:37 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.35 2000/07/05 23:11:19 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -360,7 +360,9 @@ pqtest_PQfn(char *q)
                else
                {
                        pqargs[k].len = VAR_LENGTH_ARG;
-                       pqargs[k].u.ptr = (int *) textin(fields[j]);
+                       pqargs[k].u.ptr = (int *)
+                               DatumGetTextP(DirectFunctionCall1(textin,
+                                                                                                 CStringGetDatum(fields[j])));
                        printf("pqtest_PQfn: arg %d is text %s\n", k, fields[j]);       /* debug */
                }
        }
@@ -405,9 +407,8 @@ pqtest(struct varlena * vlena)
         *      get the query
         * ----------------
         */
-       q = textout(vlena);
-       if (q == NULL)
-               return -1;
+       q = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                       PointerGetDatum(vlena)));
 
        switch (q[0])
        {
index d727ddc24b6c5e30bfefa99c9323cb4c6510d56e..7b87555df0991fe7a7fffc9ff3a66f52395f8613 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.85 2000/05/30 00:49:47 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.86 2000/07/05 23:11:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1658,7 +1658,8 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
                case OID_VARCHAR_LIKE_OP:
                case OID_NAME_LIKE_OP:
                        /* the right-hand const is type text for all of these */
-                       patt = textout((text *) DatumGetPointer(constvalue));
+                       patt = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                          constvalue));
                        isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Like,
                                                                                           &prefix, &rest) != Pattern_Prefix_None;
                        if (prefix)
@@ -1671,7 +1672,8 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
                case OID_VARCHAR_REGEXEQ_OP:
                case OID_NAME_REGEXEQ_OP:
                        /* the right-hand const is type text for all of these */
-                       patt = textout((text *) DatumGetPointer(constvalue));
+                       patt = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                          constvalue));
                        isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Regex,
                                                                                           &prefix, &rest) != Pattern_Prefix_None;
                        if (prefix)
@@ -1684,7 +1686,8 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
                case OID_VARCHAR_ICREGEXEQ_OP:
                case OID_NAME_ICREGEXEQ_OP:
                        /* the right-hand const is type text for all of these */
-                       patt = textout((text *) DatumGetPointer(constvalue));
+                       patt = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                          constvalue));
                        isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Regex_IC,
                                                                                           &prefix, &rest) != Pattern_Prefix_None;
                        if (prefix)
@@ -1784,7 +1787,8 @@ expand_indexqual_conditions(List *indexquals)
                        case OID_NAME_LIKE_OP:
                                /* the right-hand const is type text for all of these */
                                constvalue = ((Const *) rightop)->constvalue;
-                               patt = textout((text *) DatumGetPointer(constvalue));
+                               patt = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                                  constvalue));
                                pstatus = pattern_fixed_prefix(patt, Pattern_Type_Like,
                                                                                           &prefix, &rest);
                                resultquals = nconc(resultquals,
@@ -1801,7 +1805,8 @@ expand_indexqual_conditions(List *indexquals)
                        case OID_NAME_REGEXEQ_OP:
                                /* the right-hand const is type text for all of these */
                                constvalue = ((Const *) rightop)->constvalue;
-                               patt = textout((text *) DatumGetPointer(constvalue));
+                               patt = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                                  constvalue));
                                pstatus = pattern_fixed_prefix(patt, Pattern_Type_Regex,
                                                                                           &prefix, &rest);
                                resultquals = nconc(resultquals,
@@ -1818,7 +1823,8 @@ expand_indexqual_conditions(List *indexquals)
                        case OID_NAME_ICREGEXEQ_OP:
                                /* the right-hand const is type text for all of these */
                                constvalue = ((Const *) rightop)->constvalue;
-                               patt = textout((text *) DatumGetPointer(constvalue));
+                               patt = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                                  constvalue));
                                pstatus = pattern_fixed_prefix(patt, Pattern_Type_Regex_IC,
                                                                                           &prefix, &rest);
                                resultquals = nconc(resultquals,
@@ -1965,7 +1971,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...
@@ -1973,7 +1978,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));
 }
 
 /*
index 5c94c87487b5d02edbd25785d012831ef4f83d6a..1bec741c48b657d057faf3a328d03e54acd64a09 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.58 2000/06/20 04:22:14 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.59 2000/07/05 23:11:26 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -125,8 +125,10 @@ find_secondary_indexes(Query *root, Index relid)
                info->indproc = index->indproc; /* functional index ?? */
                if (VARSIZE(&index->indpred) != 0)              /* partial index ?? */
                {
-                       char       *predString = textout(&index->indpred);
+                       char       *predString;
 
+                       predString = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                       PointerGetDatum(&index->indpred)));
                        info->indpred = (List *) stringToNode(predString);
                        pfree(predString);
                }
index f6e01a05ac42053ef4ddf5daa066b2eac88133c0..104a0cb926c29c9bb31adedd3c59bd895ae3f1f9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.44 2000/06/15 03:32:19 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.45 2000/07/05 23:11:32 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -77,7 +77,8 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
                if (!con->constisnull)
                {
                        /* We know the source constant is really of type 'text' */
-                       char       *val = textout((text *) con->constvalue);
+                       char       *val = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                               con->constvalue));
 
                        newcon->constvalue = stringTypeDatum(targetType, val, atttypmod);
                        pfree(val);
index e23d7930b66441968cb6fe6bea64a02ebe791259..273dc0ef64414d4f5d4035c4d0fdb5a5d4af621c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.42 2000/06/14 18:17:36 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.43 2000/07/05 23:11:32 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -462,7 +462,7 @@ make_const(Value *value)
                        break;
 
                case T_String:
-                       val = PointerGetDatum(textin(strVal(value)));
+                       val = DirectFunctionCall1(textin, CStringGetDatum(strVal(value)));
 
                        typeid = UNKNOWNOID;/* will be coerced later */
                        typelen = -1;           /* variable len */
index cf7d3618426a004de6ffdd12eaf640828ef5affc..3df0fe3557952dabc9053e199f3d05e55b2eeb7b 100644 (file)
@@ -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
index 052b68137f8843eaa38ce677b3a8ac24f64e8d8b..6bb7bac705d8d41b7b98cea1a635303321f3d6b1 100644 (file)
@@ -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++)
        {
index 5cd46bb0de203729dded6fa1595eeb56fe4c58f1..d46c81157da8f56320fff703c6363e22882ba393 100644 (file)
@@ -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));
 }
 
 /*-------------------------------------------------------------------------
index 263470a063cf54a675bbc41fb947181228fdb9cd..7d0f4447c2d627ea143711de186adc105c14b23b 100644 (file)
@@ -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);
index 4b3f498a2af665f5f5f9d60a500810fa24f454a6..d5d5b86f9fe8ffb674dd4afd7e1a8c94b309ee18 100644 (file)
@@ -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++)
index 114bcff29a4ab914cfacb5d68794808ee0c7d3bf..8ddabdb4ee4efef3d6257863a9d67bafb45ce525 100644 (file)
@@ -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);
 }
 
 
index 867de40baa92e0332d3c60e70c7974ad98eda7cd..7e9d18c7e27727627044effa4806107cbc81ffb5 100644 (file)
@@ -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));
                }
        }
 
index dc69a0e508fc42a5c9b634d5f93cc144b8a37a72..c1cc688e8f61d430e80ba8f464dbde8e3d03155e 100644 (file)
@@ -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);
index baa89be7bb8c8e89878702a5d224e70c628b223d..3913dddeec2c721e443100a083e6c2163f384ad6 100644 (file)
@@ -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);
 
index 489d8c260fd385ea9c510e0534f6e6b240be7132..fd732c8f94de188d88aa5cebb570c56de97106e7 100644 (file)
@@ -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",
index 3d700dcf2b7182636d8bbc9e631837e1c4c0b05d..b4af7610159da979d97711b8bdc3fd55901a69a4 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_proc.h,v 1.141 2000/06/19 03:54:45 tgl Exp $
+ * $Id: pg_proc.h,v 1.142 2000/07/05 23:11:45 tgl Exp $
  *
  * NOTES
  *       The script catalog/genbki.sh reads this file and generates .bki
@@ -129,9 +129,9 @@ DATA(insert OID =  44 (  regprocin             PGUID 12 f t f t 1 f 24 "0" 100 0 0 100
 DESCR("(internal)");
 DATA(insert OID =  45 (  regprocout               PGUID 12 f t f t 1 f 23 "0" 100 0 0 100  regprocout - ));
 DESCR("(internal)");
-DATA(insert OID =  46 (  textin                           PGUID 11 f t t t 1 f 25 "0" 100 0 0 100  textin - ));
+DATA(insert OID =  46 (  textin                           PGUID 12 f t t t 1 f 25 "0" 100 0 0 100  textin - ));
 DESCR("(internal)");
-DATA(insert OID =  47 (  textout                  PGUID 11 f t t t 1 f 23 "0" 100 0 0 100  textout - ));
+DATA(insert OID =  47 (  textout                  PGUID 12 f t t t 1 f 23 "0" 100 0 0 100  textout - ));
 DESCR("(internal)");
 DATA(insert OID =  48 (  tidin                    PGUID 11 f t t t 1 f 27 "0" 100 0 0 100  tidin - ));
 DESCR("(internal)");
index 267d7c55d12866f5c51fa95578e872ece222e196..9e7e995ee16c26b8207de50640a6be02ac4b0134 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: builtins.h,v 1.118 2000/06/19 03:54:48 tgl Exp $
+ * $Id: builtins.h,v 1.119 2000/07/05 23:11:51 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -436,8 +436,8 @@ extern int32 varcharlen(char *arg);
 extern int32 varcharoctetlen(char *arg);
 
 /* varlena.c */
-extern text *textin(char *inputText);
-extern char *textout(text *vlena);
+extern Datum textin(PG_FUNCTION_ARGS);
+extern Datum textout(PG_FUNCTION_ARGS);
 extern text *textcat(text *arg1, text *arg2);
 extern bool texteq(text *arg1, text *arg2);
 extern bool textne(text *arg1, text *arg2);
index 66ae44373d06ab5a6170c0cbaee3874d83ab984f..687612a64c1498b2368f8235cbfcf71ffdbb3783 100644 (file)
@@ -33,7 +33,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.11 2000/06/05 07:29:11 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.12 2000/07/05 23:11:55 tgl Exp $
  *
  **********************************************************************/
 
@@ -594,8 +594,8 @@ plperl_func_handler(PG_FUNCTION_ARGS)
                 * through the reference.
                 *
                 ************************************************************/
-               proc_source = textout(&(procStruct->prosrc));
-
+               proc_source = DatumGetCString(DirectFunctionCall1(textout,
+                                                                       PointerGetDatum(&procStruct->prosrc)));
 
                /************************************************************
                 * Create the procedure in the interpreter
@@ -789,7 +789,8 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
                                                  "}\n"
                                                  "unset i v\n\n", -1);
 
-               proc_source = textout(&(procStruct->prosrc));
+               proc_source = DatumGetCString(DirectFunctionCall1(textout,
+                                                                       PointerGetDatum(&procStruct->prosrc)));
                Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
                pfree(proc_source);
                Tcl_DStringAppendElement(&proc_internal_def,
index c03d9398d139a50296114892a5066165923b7fb8..f18caa846440bc46a58e185492e3208b4acce9c2 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.20 2000/05/11 04:00:00 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.21 2000/07/05 23:11:58 tgl Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -142,7 +142,8 @@ plpgsql_compile(Oid fn_oid, int functype)
         * ----------
         */
        procStruct = (Form_pg_proc) GETSTRUCT(procTup);
-       proc_source = textout(&(procStruct->prosrc));
+       proc_source = DatumGetCString(DirectFunctionCall1(textout,
+                                                                       PointerGetDatum(&procStruct->prosrc)));
        plpgsql_setinput(proc_source, functype);
        plpgsql_error_funcname = nameout(&(procStruct->proname));
        plpgsql_error_lineno = 0;
index 77370801c9c4c51e3fed4aa0ab7e73b96dc29100..5b8c6d773f4931d285621554a9f6641f2b9ba1e2 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.23 2000/05/30 04:24:58 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.24 2000/07/05 23:11:58 tgl Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -606,7 +606,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
                rec_new->tupdesc = trigdata->tg_relation->rd_att;
                rec_old->tup = NULL;
                rec_old->tupdesc = NULL;
-               var->value = (Datum) textin("INSERT");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("INSERT"));
        }
        else if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
        {
@@ -614,7 +614,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
                rec_new->tupdesc = trigdata->tg_relation->rd_att;
                rec_old->tup = trigdata->tg_trigtuple;
                rec_old->tupdesc = trigdata->tg_relation->rd_att;
-               var->value = (Datum) textin("UPDATE");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("UPDATE"));
        }
        else if (TRIGGER_FIRED_BY_DELETE(trigdata->tg_event))
        {
@@ -622,13 +622,13 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
                rec_new->tupdesc = NULL;
                rec_old->tup = trigdata->tg_trigtuple;
                rec_old->tupdesc = trigdata->tg_relation->rd_att;
-               var->value = (Datum) textin("DELETE");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("DELETE"));
        }
        else
        {
                rec_new->tup = NULL;
                rec_new->tupdesc = NULL;
-               var->value = (Datum) textin("UNKNOWN");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
        }
 
        /* ----------
@@ -642,20 +642,20 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
        var = (PLpgSQL_var *) (estate.datums[func->tg_when_varno]);
        var->isnull = false;
        if (TRIGGER_FIRED_BEFORE(trigdata->tg_event))
-               var->value = (Datum) textin("BEFORE");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("BEFORE"));
        else if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
-               var->value = (Datum) textin("AFTER");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("AFTER"));
        else
-               var->value = (Datum) textin("UNKNOWN");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
 
        var = (PLpgSQL_var *) (estate.datums[func->tg_level_varno]);
        var->isnull = false;
        if (TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
-               var->value = (Datum) textin("ROW");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("ROW"));
        else if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
-               var->value = (Datum) textin("STATEMENT");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("STATEMENT"));
        else
-               var->value = (Datum) textin("UNKNOWN");
+               var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
 
        var = (PLpgSQL_var *) (estate.datums[func->tg_relid_varno]);
        var->isnull = false;
@@ -682,7 +682,8 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
        {
                estate.trig_argv = palloc(sizeof(Datum) * estate.trig_nargs);
                for (i = 0; i < trigdata->tg_trigger->tgnargs; i++)
-                       estate.trig_argv[i] = (Datum) textin(trigdata->tg_trigger->tgargs[i]);
+                       estate.trig_argv[i] = DirectFunctionCall1(textin,
+                                                       CStringGetDatum(trigdata->tg_trigger->tgargs[i]));
        }
 
        /* ----------
@@ -1611,7 +1612,8 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
                                                        if (value < 0 || value >= estate->trig_nargs)
                                                                extval = "<OUT_OF_RANGE>";
                                                        else
-                                                               extval = textout((text *) (estate->trig_argv[value]));
+                                                               extval = DatumGetCString(DirectFunctionCall1(textout,
+                                                                                                       estate->trig_argv[value]));
                                                }
                                                plpgsql_dstring_append(&ds, extval);
                                        }
index 37b413da2df2cb030bd326a9e359f051a2ca6927..6bdeec9be81cfe14c9490a69e9dbb798b420fe1b 100644 (file)
@@ -31,7 +31,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.26 2000/06/05 07:29:13 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.27 2000/07/05 23:12:03 tgl Exp $
  *
  **********************************************************************/
 
@@ -561,7 +561,8 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
                        sprintf(buf, "array set %d $__PLTcl_Tup_%d\n", i + 1, i + 1);
                        Tcl_DStringAppend(&proc_internal_body, buf, -1);
                }
-               proc_source = textout(&(procStruct->prosrc));
+               proc_source = DatumGetCString(DirectFunctionCall1(textout,
+                                                                       PointerGetDatum(&procStruct->prosrc)));
                Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
                pfree(proc_source);
                Tcl_DStringAppendElement(&proc_internal_def,
@@ -836,7 +837,8 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
                                                  "}\n"
                                                  "unset i v\n\n", -1);
 
-               proc_source = textout(&(procStruct->prosrc));
+               proc_source = DatumGetCString(DirectFunctionCall1(textout,
+                                                                       PointerGetDatum(&procStruct->prosrc)));
                Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
                pfree(proc_source);
                Tcl_DStringAppendElement(&proc_internal_def,
index 67c62c8ab65b2232b280fbcadea969dcf9f734c1..ca2f0a69caa24da47a415defafdf1fe379d426f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.40 2000/06/13 07:35:34 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.41 2000/07/05 23:12:09 tgl Exp $
  */
 
 #include <float.h>                             /* faked on sunos */
@@ -524,7 +524,8 @@ ttdummy(PG_FUNCTION_ARGS)
        }
 
        {
-               text   *seqname = textin("ttdummy_seq");
+               text   *seqname = DatumGetTextP(DirectFunctionCall1(textin,
+                                                                                       CStringGetDatum("ttdummy_seq")));
 
                newoff = DirectFunctionCall1(nextval,
                                                                         PointerGetDatum(seqname));