summaryrefslogtreecommitdiff
path: root/contrib/spi
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-07-05 23:12:09 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-07-05 23:12:09 +0000
commit40f64064ff56c3118d156ba83df72b1779415a8a (patch)
treed318bf6c8e6e85a15d2cd6e997ee02bf233dd181 /contrib/spi
parent282713a836d5dfe3dcefeaa6a6cedf5f000bdb09 (diff)
downloadpostgresql-40f64064ff56c3118d156ba83df72b1779415a8a.tar.gz
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.
Diffstat (limited to 'contrib/spi')
-rw-r--r--contrib/spi/autoinc.c16
-rw-r--r--contrib/spi/insert_username.c2
2 files changed, 9 insertions, 9 deletions
diff --git a/contrib/spi/autoinc.c b/contrib/spi/autoinc.c
index 804e1d6383..f8b86217e7 100644
--- a/contrib/spi/autoinc.c
+++ b/contrib/spi/autoinc.c
@@ -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++;
}
diff --git a/contrib/spi/insert_username.c b/contrib/spi/insert_username.c
index 61b4150084..978a873ec9 100644
--- a/contrib/spi/insert_username.c
+++ b/contrib/spi/insert_username.c
@@ -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);