diff options
author | Tom Lane | 2000-06-11 20:08:01 +0000 |
---|---|---|
committer | Tom Lane | 2000-06-11 20:08:01 +0000 |
commit | 3477957b44baf2b53f95207ff8824a0361301a2e (patch) | |
tree | d3b15fe37f59cc4423a59a734d65dd48615fb265 /contrib/spi/autoinc.c | |
parent | e9acba1aded0caf2f7e02e8f1bbb813207d8cc8d (diff) |
Update sequence-related functions to new fmgr style. Remove downcasing,
quote-stripping, and acl-checking tasks for these functions from the
parser, and do them at function execution time instead. This fixes
the failure of pg_dump to produce correct output for nextval(Foo)
used in a rule, and also eliminates the restriction that the argument
of these functions must be a parse-time constant.
Diffstat (limited to 'contrib/spi/autoinc.c')
-rw-r--r-- | contrib/spi/autoinc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/spi/autoinc.c b/contrib/spi/autoinc.c index 33cce45723..804e1d6383 100644 --- a/contrib/spi/autoinc.c +++ b/contrib/spi/autoinc.c @@ -1,9 +1,9 @@ #include "executor/spi.h" /* this is what you need to work with SPI */ #include "commands/trigger.h" /* -"- and triggers */ +#include "commands/sequence.h" /* for nextval() */ extern Datum autoinc(PG_FUNCTION_ARGS); -extern int4 nextval(struct varlena * seqin); Datum autoinc(PG_FUNCTION_ARGS) @@ -53,7 +53,7 @@ autoinc(PG_FUNCTION_ARGS) for (i = 0; i < nargs;) { - struct varlena *seqname; + text *seqname; int attnum = SPI_fnumber(tupdesc, args[i]); int32 val; @@ -74,9 +74,11 @@ autoinc(PG_FUNCTION_ARGS) i++; chattrs[chnattrs] = attnum; seqname = textin(args[i]); - newvals[chnattrs] = Int32GetDatum(nextval(seqname)); + newvals[chnattrs] = DirectFunctionCall1(nextval, + PointerGetDatum(seqname)); if (DatumGetInt32(newvals[chnattrs]) == 0) - newvals[chnattrs] = Int32GetDatum(nextval(seqname)); + newvals[chnattrs] = DirectFunctionCall1(nextval, + PointerGetDatum(seqname)); pfree(seqname); chnattrs++; i++; |