diff options
Diffstat (limited to 'src/pl')
-rw-r--r-- | src/pl/plperl/plperl.c | 34 | ||||
-rw-r--r-- | src/pl/plpgsql/src/pl_comp.c | 6 | ||||
-rw-r--r-- | src/pl/plpgsql/src/plpgsql.h | 4 | ||||
-rw-r--r-- | src/pl/plpython/plpython.c | 8 | ||||
-rw-r--r-- | src/pl/tcl/pltcl.c | 8 |
5 files changed, 29 insertions, 31 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 0cf8c57a137..33027c53bde 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1,7 +1,7 @@ /********************************************************************** * plperl.c - perl as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.126 2007/02/01 19:10:29 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.127 2007/02/09 03:35:34 tgl Exp $ * **********************************************************************/ @@ -41,7 +41,7 @@ typedef struct plperl_proc_desc { char *proname; TransactionId fn_xmin; - CommandId fn_cmin; + ItemPointerData fn_tid; bool fn_readonly; bool lanpltrusted; bool fn_retistuple; /* true, if function returns tuple */ @@ -296,7 +296,7 @@ _PG_init(void) * * We start out by creating a "held" interpreter that we can use in * trusted or untrusted mode (but not both) as the need arises. Later, we - * assign that interpreter if it is available to either the trusted or + * assign that interpreter if it is available to either the trusted or * untrusted interpreter. If it has already been assigned, and we need to * create the other interpreter, we do that if we can, or error out. * We detect if it is safe to run two interpreters during the setup of the @@ -304,7 +304,7 @@ _PG_init(void) */ -static void +static void check_interp(bool trusted) { if (interp_state == INTERP_HELD) @@ -322,7 +322,7 @@ check_interp(bool trusted) plperl_held_interp = NULL; trusted_context = trusted; } - else if (interp_state == INTERP_BOTH || + else if (interp_state == INTERP_BOTH || (trusted && interp_state == INTERP_TRUSTED) || (!trusted && interp_state == INTERP_UNTRUSTED)) { @@ -349,11 +349,9 @@ check_interp(bool trusted) } else { - elog(ERROR, + elog(ERROR, "cannot allocate second Perl interpreter on this platform"); - } - } @@ -425,7 +423,7 @@ plperl_init_interp(void) elog(ERROR, "could not allocate Perl interpreter"); perl_construct(plperl_held_interp); - perl_parse(plperl_held_interp, plperl_init_shared_libs, + perl_parse(plperl_held_interp, plperl_init_shared_libs, 3, embedding, NULL); perl_run(plperl_held_interp); @@ -434,7 +432,7 @@ plperl_init_interp(void) SV *res; res = eval_pv(TEST_FOR_MULTI,TRUE); - can_run_two = SvIV(res); + can_run_two = SvIV(res); interp_state = INTERP_HELD; } @@ -1430,7 +1428,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) /************************************************************ * Lookup the internal proc name in the hashtable ************************************************************/ - hash_entry = hash_search(plperl_proc_hash, internal_proname, + hash_entry = hash_search(plperl_proc_hash, internal_proname, HASH_FIND, NULL); if (hash_entry) @@ -1445,7 +1443,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) * function's pg_proc entry without changing its OID. ************************************************************/ uptodate = (prodesc->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) && - prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)); + ItemPointerEquals(&prodesc->fn_tid, &procTup->t_self)); if (!uptodate) { @@ -1485,7 +1483,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) MemSet(prodesc, 0, sizeof(plperl_proc_desc)); prodesc->proname = strdup(internal_proname); prodesc->fn_xmin = HeapTupleHeaderGetXmin(procTup->t_data); - prodesc->fn_cmin = HeapTupleHeaderGetCmin(procTup->t_data); + prodesc->fn_tid = procTup->t_self; /* Remember if function is STABLE/IMMUTABLE */ prodesc->fn_readonly = @@ -2128,9 +2126,9 @@ plperl_spi_prepare(char *query, int argc, SV **argv) PG_TRY(); { /************************************************************ - * Resolve argument type names and then look them up by oid - * in the system cache, and remember the required information - * for input conversion. + * Resolve argument type names and then look them up by oid + * in the system cache, and remember the required information + * for input conversion. ************************************************************/ for (i = 0; i < argc; i++) { @@ -2523,8 +2521,8 @@ plperl_spi_freeplan(char *query) * free all memory before SPI_freeplan, so if it dies, nothing will be * left over */ - hash_search(plperl_query_hash, query, - HASH_REMOVE,NULL); + hash_search(plperl_query_hash, query, + HASH_REMOVE, NULL); plan = qdesc->plan; free(qdesc->argtypes); diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index c342ed3e85b..44fae0f1b28 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.112 2007/02/08 18:37:14 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.113 2007/02/09 03:35:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -165,7 +165,7 @@ recheck: { /* We have a compiled function, but is it still valid? */ if (function->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) && - function->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)) + ItemPointerEquals(&function->fn_tid, &procTup->t_self)) function_valid = true; else { @@ -355,7 +355,7 @@ do_compile(FunctionCallInfo fcinfo, function->fn_name = pstrdup(NameStr(procStruct->proname)); function->fn_oid = fcinfo->flinfo->fn_oid; function->fn_xmin = HeapTupleHeaderGetXmin(procTup->t_data); - function->fn_cmin = HeapTupleHeaderGetCmin(procTup->t_data); + function->fn_tid = procTup->t_self; function->fn_functype = functype; function->fn_cxt = func_cxt; function->out_param_varno = -1; /* set up for no OUT param */ diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index dad5ba5bb4b..9f29fcd5da5 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.84 2007/01/30 22:05:13 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.85 2007/02/09 03:35:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -547,7 +547,7 @@ typedef struct PLpgSQL_function char *fn_name; Oid fn_oid; TransactionId fn_xmin; - CommandId fn_cmin; + ItemPointerData fn_tid; int fn_functype; PLpgSQL_func_hashkey *fn_hashkey; /* back-link to hashtable key */ MemoryContext fn_cxt; diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index cd0f701581e..90a3f87b150 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -1,7 +1,7 @@ /********************************************************************** * plpython.c - python as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.94 2007/02/01 19:10:30 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.95 2007/02/09 03:35:35 tgl Exp $ * ********************************************************************* */ @@ -123,7 +123,7 @@ typedef struct PLyProcedure char *proname; /* SQL name of procedure */ char *pyname; /* Python name of procedure */ TransactionId fn_xmin; - CommandId fn_cmin; + ItemPointerData fn_tid; bool fn_readonly; PLyTypeInfo result; /* also used to store info for trigger tuple * type */ @@ -1100,7 +1100,7 @@ PLy_procedure_get(FunctionCallInfo fcinfo, Oid tgreloid) elog(FATAL, "proc->me != plproc"); /* did we find an up-to-date cache entry? */ if (proc->fn_xmin != HeapTupleHeaderGetXmin(procTup->t_data) || - proc->fn_cmin != HeapTupleHeaderGetCmin(procTup->t_data)) + !ItemPointerEquals(&proc->fn_tid, &procTup->t_self)) { Py_DECREF(plproc); proc = NULL; @@ -1151,7 +1151,7 @@ PLy_procedure_create(FunctionCallInfo fcinfo, Oid tgreloid, proc->proname = PLy_strdup(NameStr(procStruct->proname)); proc->pyname = PLy_strdup(procName); proc->fn_xmin = HeapTupleHeaderGetXmin(procTup->t_data); - proc->fn_cmin = HeapTupleHeaderGetCmin(procTup->t_data); + proc->fn_tid = procTup->t_self; /* Remember if function is STABLE/IMMUTABLE */ proc->fn_readonly = (procStruct->provolatile != PROVOLATILE_VOLATILE); diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 7611fa7cc76..0477fa8c56c 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -2,7 +2,7 @@ * pltcl.c - PostgreSQL support for Tcl as * procedural language (PL) * - * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.109 2007/02/01 19:10:30 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.110 2007/02/09 03:35:35 tgl Exp $ * **********************************************************************/ @@ -76,7 +76,7 @@ typedef struct pltcl_proc_desc { char *proname; TransactionId fn_xmin; - CommandId fn_cmin; + ItemPointerData fn_tid; bool fn_readonly; bool lanpltrusted; FmgrInfo result_in_func; @@ -962,7 +962,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid) prodesc = (pltcl_proc_desc *) Tcl_GetHashValue(hashent); uptodate = (prodesc->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) && - prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)); + ItemPointerEquals(&prodesc->fn_tid, &procTup->t_self)); if (!uptodate) { @@ -1004,7 +1004,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid) MemSet(prodesc, 0, sizeof(pltcl_proc_desc)); prodesc->proname = strdup(internal_proname); prodesc->fn_xmin = HeapTupleHeaderGetXmin(procTup->t_data); - prodesc->fn_cmin = HeapTupleHeaderGetCmin(procTup->t_data); + prodesc->fn_tid = procTup->t_self; /* Remember if function is STABLE/IMMUTABLE */ prodesc->fn_readonly = |