Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- preserve callers memory context rather than assuming query memory c…

…ontext

- register plr_atexit using atexit() so that when R interpreter exit()'s on
  failure to initialize (e.g. if R_HOME is incorrect) we throw an error
  instead of killing the postgres backend unexpectedly
- replace call to R function lcons() with explicit call to Rf_lcons() since
  postgres also has an lcons() function (Neil Conway)
- use PG_DETOAST_DATUM() on array arguments to ensure they get detoasted
  if needed.
- R and Postgres attempt to define symbols with the same name in their
  header files. Change to alternative that is less of a kludge
  (Neil Conway)
- fix for R_VERSION >= 2.5.0, R_ParseVector has extra arguments
  • Loading branch information...
commit f7a36401075ee6d02894994207322a8488bedb4a 1 parent 2f6f75f
jconway authored
Showing with 6 additions and 13 deletions.
  1. +3 −10 plr.c
  2. +3 −3 plr.h
View
13 plr.c
@@ -729,16 +729,9 @@ compile_plr_function(FunctionCallInfo fcinfo)
if (function)
{
- bool function_valid;
-
/* We have a compiled function, but is it still valid? */
- if (function->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) &&
- ItemPointerEquals(&function->fn_tid, &procTup->t_self))
- function_valid = true;
- else
- function_valid = false;
-
- if (!function_valid)
+ if (!(function->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) &&
+ function->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)))
{
/*
* Nope, drop the hashtable entry. XXX someday, free all the
@@ -843,7 +836,7 @@ do_compile(FunctionCallInfo fcinfo,
function->proname = pstrdup(proname);
function->fn_xmin = HeapTupleHeaderGetXmin(procTup->t_data);
- function->fn_tid = procTup->t_self;
+ function->fn_cmin = HeapTupleHeaderGetCmin(procTup->t_data);
/* Lookup the pg_language tuple by Oid*/
langTup = SearchSysCache(LANGOID,
View
6 plr.h
@@ -82,11 +82,11 @@
/* working with postgres 7.3 compatible sources */
#if (CATALOG_VERSION_NO <= 200510211)
-#error "This version of PL/R only builds with PostgreSQL 8.2 or later"
+#error "This version of PL/R only builds with PostgreSQL 8.2"
#elif (CATALOG_VERSION_NO <= 200611241)
#define PG_VERSION_82_COMPAT
#else
-#define PG_VERSION_83_COMPAT
+#error "This version of PL/R only builds with PostgreSQL 8.2"
#endif
#ifdef DEBUGPROTECT
@@ -389,7 +389,7 @@ typedef struct plr_function
{
char *proname;
TransactionId fn_xmin;
- ItemPointerData fn_tid;
+ CommandId fn_cmin;
plr_func_hashkey *fn_hashkey; /* back-link to hashtable key */
bool lanpltrusted;
Oid result_typid;
Please sign in to comment.
Something went wrong with that request. Please try again.