summaryrefslogtreecommitdiff
path: root/contrib/spi/autoinc.c
diff options
context:
space:
mode:
authorTom Lane2000-07-05 23:12:09 +0000
committerTom Lane2000-07-05 23:12:09 +0000
commit40f64064ff56c3118d156ba83df72b1779415a8a (patch)
treed318bf6c8e6e85a15d2cd6e997ee02bf233dd181 /contrib/spi/autoinc.c
parent282713a836d5dfe3dcefeaa6a6cedf5f000bdb09 (diff)
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/autoinc.c')
-rw-r--r--contrib/spi/autoinc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/spi/autoinc.c b/contrib/spi/autoinc.c
index 804e1d63838..f8b86217e73 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++;
}