mirror of
https://github.com/postgres/postgres.git
synced 2025-08-14 02:22:38 +03:00
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.)
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.252 2007/02/27 23:48:08 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.253 2007/03/15 23:12:06 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -105,9 +105,9 @@ typedef struct
|
||||
* Global data
|
||||
* ----------
|
||||
*/
|
||||
static void *plan_getrulebyoid = NULL;
|
||||
static SPIPlanPtr plan_getrulebyoid = NULL;
|
||||
static char *query_getrulebyoid = "SELECT * FROM pg_catalog.pg_rewrite WHERE oid = $1";
|
||||
static void *plan_getviewrule = NULL;
|
||||
static SPIPlanPtr plan_getviewrule = NULL;
|
||||
static char *query_getviewrule = "SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2";
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ pg_get_ruledef_worker(Oid ruleoid, int prettyFlags)
|
||||
if (plan_getrulebyoid == NULL)
|
||||
{
|
||||
Oid argtypes[1];
|
||||
void *plan;
|
||||
SPIPlanPtr plan;
|
||||
|
||||
argtypes[0] = OIDOID;
|
||||
plan = SPI_prepare(query_getrulebyoid, 1, argtypes);
|
||||
@@ -380,7 +380,7 @@ pg_get_viewdef_worker(Oid viewoid, int prettyFlags)
|
||||
if (plan_getviewrule == NULL)
|
||||
{
|
||||
Oid argtypes[2];
|
||||
void *plan;
|
||||
SPIPlanPtr plan;
|
||||
|
||||
argtypes[0] = OIDOID;
|
||||
argtypes[1] = NAMEOID;
|
||||
|
Reference in New Issue
Block a user