diff options
author | Tom Lane | 2007-03-15 23:12:07 +0000 |
---|---|---|
committer | Tom Lane | 2007-03-15 23:12:07 +0000 |
commit | 95f6d2d20921b7c2dbec29bf2706fd9448208aa6 (patch) | |
tree | 21dcb36f9df60546d82d547a7855605be73a771c /contrib/spi/refint.c | |
parent | d3ff180163a0c88d7a05e0c865f649e5d8bcd6e1 (diff) |
Make use of plancache module for SPI plans. In particular, since plpgsql
uses SPI plans, this finally fixes the ancient gotcha that you can't
drop and recreate a temp table used by a plpgsql function.
Along the way, clean up SPI's API a little bit by declaring SPI plan
pointers as "SPIPlanPtr" instead of "void *". This is cosmetic but
helps to forestall simple programming mistakes. (I have changed some
but not all of the callers to match; there are still some "void *"'s
in contrib and the PL's. This is intentional so that we can see if
anyone's compiler complains about it.)
Diffstat (limited to 'contrib/spi/refint.c')
-rw-r--r-- | contrib/spi/refint.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c0c55eb080..d88975d5e9 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -19,7 +19,7 @@ typedef struct { char *ident; int nplans; - void **splan; + SPIPlanPtr *splan; } EPlan; static EPlan *FPlans = NULL; @@ -163,7 +163,7 @@ check_primary_key(PG_FUNCTION_ARGS) */ if (plan->nplans <= 0) { - void *pplan; + SPIPlanPtr pplan; char sql[8192]; /* @@ -191,7 +191,7 @@ check_primary_key(PG_FUNCTION_ARGS) if (pplan == NULL) /* internal error */ elog(ERROR, "check_primary_key: SPI_saveplan returned %d", SPI_result); - plan->splan = (void **) malloc(sizeof(void *)); + plan->splan = (SPIPlanPtr *) malloc(sizeof(SPIPlanPtr)); *(plan->splan) = pplan; plan->nplans = 1; } @@ -413,11 +413,11 @@ check_foreign_key(PG_FUNCTION_ARGS) */ if (plan->nplans <= 0) { - void *pplan; + SPIPlanPtr pplan; char sql[8192]; char **args2 = args; - plan->splan = (void **) malloc(nrefs * sizeof(void *)); + plan->splan = (SPIPlanPtr *) malloc(nrefs * sizeof(SPIPlanPtr)); for (r = 0; r < nrefs; r++) { |