Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Feb 8, 2015
  1. Update copyright dates

Commits on Feb 19, 2013
  1. Update copyright for 2013

    Change version to
    Remove hack to take signal back from R interpreter
    Set R_SignalHandlers = 0, the proper way to prevent R from taking signals in the first place
    Adjust RPM spec file
Commits on Oct 10, 2010
Commits on Sep 12, 2010
  1. - Fix crashbug where array datum is NULL under certain circumstances

    - Fix failure under recursive SPI calls
    - Fix crashbug where error message used dangling pointer
Commits on Jul 24, 2010
  1. - Minor improvements to how/when SPI is connected which

      reduces unnecessary memory context switching/thrashing
    - Special case array marshalling, in and out, for int4 and float8
      arrays if the following conditions are met:
        * int4[] or float8[], pg->R
        * INTSXP -> int4[], R->pg
        * REALSXP -> float8[] R->pg
        * typbyval (for float8 is true if pg>=8.4 and arch=x86_64 and others?)
        * No NULL elements, pg->R
        * No NAs, R->pg
        * One dimensional array (pg) or vector (R)
        * At least one element
      This results in dramtic performance improvement when, for example,
      passing very large float8 arrays on a 64 bit machine from pg to R.
Commits on Feb 1, 2010
  1. - Updated copyright notices for 2010

    jconway authored
    - Remove obsolete info from README and point to web site instead
    - Consolidate and reorder all header files in order to avoid
      namespace conflicts between postgres/R/Win32
    - Rather than referencing pkglib_path and Dynamic_library_path,
      reference my_exec_path instead. This is because the former are
      not exported in win32 and the latter is. Instead get Dynamic_library_path
      by calling GetConfigOptionByName() and pkglib_path by calling
    - Recognize hex input since bytea output is formatted that way by
      default starting with PostgreSQL 9.0
    - Avoid dynamic assignments with array constructors since MSVC
      cannot handle them.
    - Workaround fact that "char **environ" is not available on win32
      for plr_environ()
Commits on Apr 19, 2009
  1. - updated copyright statements

    jconway authored
    - Makefile fix for Mac OSX per kostas savvidis
    - Added RPostgreSQL compatability functions
    - Added ability to send serialized R objects to Postgres as bytea return values
    - Added ability to convert bytea arguments from Postgres back into the original R object
    - Added function to unserialize bytea value in order to restore object outside of R (useful for image data)
Commits on Jul 4, 2008
  1. - Fix Makefile for include directory names with embedded spaces

    jconway authored
    - Eliminate warnings that started with R-2.6.0 related to lack of
      const declarations
    - Add --no-restore to startup options
    - Fix old bug related to Rversion.h appearing after user of R_VERSION
      in precompiler tests. Led to Rembedded.h not getting included
    - Added explicit define for KillAllDevices as it has been removed
      from Rdevices.h as of R-2.7.0
Commits on Sep 8, 2007
  1. - Update all Copyright notices.

    jconway authored
    - New (undocumented) functions r_version(), plr_set_rhome(),
      and plr_unset_rhome().
    - Use Rembedded.h if available
    - If R_HOME environment variable is not defined, attempt to find it using
      pkg-config. (idea from Dirk Eddelbuettel)
    - In any case, create define for default R_HOME based on pkg-config. Use
      the default R_HOME during R interpreter init if the environment variable
      is unset. (idea from Dirk Eddelbuettel)
    - Use PGDLLIMPORT instead of DLLIMPORT is it is defined.
    - Switch to Rf_isVectorList instead of IS_LIST for spi_execp argument test.
      Prior to R-2.4.0, the latter allows bad arguments to get past, causing
      a segfault in an R internal type coersion function. (found by Steve Singer)
    - New spi cursor manupulation functions (patch courtesy of Steve Singer).
    - Force R interpreter non-interactive mode. Fixes some cases that previously
      appeared to be hung postgres backends in certain errors occured in R
      (R was actually waiting for user input). On some platforms this situation
      caused segfaults instead. (found by Jie Zhang)
    - When a plr function source is empty, plr tries to find a function by the
      same name within the R interpreter environment. If the function could not
      be found, it would cause a hang or segfault. This was not easily trapped
      in the R interpreter. Now, build and compile the equivalent plr source.
      This allows the R interpreter to trap the error properly when the function
      does not exist.
    - PG_VERSION_NUM if available. (patch courtesy of Neal Conway)
    - Plug memory leak in POP_PLERRCONTEXT. (patch courtesy of Steve Singer)
Commits on Jun 12, 2007
  1. - add DLLIMPORT to Dynamic_library_path declaration for Win32

    jconway authored
    - add pkglib_path[] declaration for Win32
    - modify debug code for PROTECT/UNPROTECT
    - add missing UNPROTECT(1) in spi code -- fix for "stack imbalance" warning
Commits on Sep 11, 2006
  1. - removed support (and overhead) for PostgreSQL prior to 8.2

    jconway authored
    - added support for NULL array elements (in and out)
    - plugged security hole courtesy of Jeff Greco <>
Commits on Sep 3, 2005
  1. - Protect against expand_dynamic_library_name(raw_path) returning NULL

    jconway authored
    - Add missing include for "utils/memutils.h". Absence before 8.1 was masked by
      it being included somewhere else in the hierarchy.
    - Adjust regression expected files for R-2.1.x. A previously rejected case
      is now handled without error. Easiest way to deal with this is to just
      remove the test entirely.
Commits on Dec 1, 2004
  1. Adjust for PostgreSQL 8.0.0 and R-2.0.1, including docs. Specifically

    jconway authored
    mention pgxs build.
Commits on Sep 1, 2004
  1. Fix improper casting of factor levels to integers. Original works fin…

    postgres authored
    …e on
    32 bit Intel systems, but causes compiler warnings and segfaults on 64 bit
    systems. Add regression test case for data.frame with a factor column that
    is not a simple non-repeating sequence.
Commits on Aug 30, 2004
  1. - Added pgxs makefile

    postgres authored
    - Allow returning tuples with array columns. Needs cleaning up,
      but works OK for now.
    - Fix resource leak -- one PROTECT() was missing its compliment
      UNPROTECT in pg_conversion.
    - Adjust for Postgres 8.0.0's PG_TRY()/PG_CATCH() in place of
      sigsetjmp(Warn_restart, 1), etc, in earlier versions.
Commits on Apr 5, 2004
  1. Code fixes and features:

    postgres authored
      - Updated copyright for year 2004
      - Transform '_' to '.' in data.frame column names derived
        from Postgres tuples for R < 1.9.0
      - Add support for explicit argument names
      - Adjust to pg7.5 tuple/slot changes
    Documentation changes:
      - Update sgml to DocBook V4.2
      - Add tip regarding /etc/ & ldconfig
      - Mention explicit argument support
      - Correct instances of "returns record" to "returns setof record"
      - Add mention of load_r_typenames() which was missing
Commits on Aug 14, 2003
  1. Little buglet in last commit -- when functions that grab Warn_restart…

    postgres authored
    … return
    early, restore Warn_restart before returning.
  2. Yet another elog bugfix pass. Now sections that might possibly generate

    postgres authored
    elog/ereports beneath plr's control while executing code called from the
    R interpreter are wrapped in "if (sigsetjmp(Warn_restart...". This grabs
    back control before it is returned to the postmaster, and allows us to
    call R's "error()" function. Now we can allow the R interpreter to
    gracefully clean up and exit with an error flagged. On the other side
    of the R eval call, we grab the error flag, and generate another error.
    This fixes issue raised by Mike Mascari.
Commits on Aug 2, 2003
  1. Reworked initialization functions to match recent changes to pltcl, e…

    postgres authored
    …t al
    in Postgres 7.4 devel.
    Reworked all elog calls to conform with new standards in 7.4 devel and
    converted to ereport where appropriate.
Commits on Jul 20, 2003
  1. throw_pg_notice minor adjustments.

    postgres authored
    Fixed problem with plr_SPI_context global not handling reentrancy
    correctly, leading to crash when throw_pg_notice was called from
    a nested plr function.
    throw_pg_error was directly long jumping out of the R interpreter
    using elog ERROR. Recently discovered that this leaves R in a
    precarious state. Modified to simply call "stop(arg)", which now
    sets up the error message and lets the elog call after R is exited
    handle our dirty work for us.
  2. Settled on method for dealing with errors originating from within the

    postgres authored
    R interpreter. Added global string "last_R_error_msg" to hold the result
    of geterrmessage(). An error in R now calls throw_r_error() with the
    result of geterrmessage() as its argument. throw_r_error() saves argument
    in last_R_error_msg. When the R call ends, PL/R will elog using
    last_R_error_msg whenever it is set, or a generic message when it is not.
    This works the same for both 7.3 and 7.4.
  3. Still working of getting errors with context from within R correct. I…

    postgres authored
    commit to save work, but probably need to replace direct elog from within
    R with some sort of global variable to stuff the error message in, then
    elog when error was detected after we emerge from the R try_eval call.
    Remove the preloaded TYPEOIDS and provide instead a new function,
    load_r_typenames(), that provides the same global variables in the
    R interpreter. But instead of making *every* connection pay the price,
    now it can be used on demand only when needed.
Commits on Jul 18, 2003
  1. Changes needed to fix compilation under postgres 7.3 after the last t…

    postgres authored
    …wo rounds
    Remove dims and dimnames attribute from data.frames created by
    pg_tuple_get_r_frame(). This fixes a problem that lm() was having
    with plr created data.frames, and appears to be correct based on the
    docs and data.frames created by R itself (examined using dput()).
    Not sure why I ever thought they were needed, but the regression
    tests still pass.
Commits on Jul 15, 2003
  1. Second pass on nested error handling

    postgres authored
Commits on Jul 14, 2003
  1. Modified compiled function hash table to be keyed on function Oid and

    postgres authored
    argument types. This should make polymorphic functions more performant.
    Design was taken from plpgsql changes recently submitted, as modified
    by Tom Lane.
    First pass attempt at error handling nesting, ala plpgsql. Does not
    seem to work. Next attempt will mimick pltcl.
Commits on Feb 28, 2003
Commits on Feb 11, 2003
  1. Fixed handling of NULL parameter lists for pg.spi.prepare and pg.spi.…

    postgres authored
    Finished first pass documentation!!!!
Commits on Feb 10, 2003
  1. Removed conversion of non-numeric data.frame columns to factors in C …

    postgres authored
    …code -- seem to produce strange results.
    Provide preloaded function pg.spi.factor as convenience function for converting non-numeric columns of spi produced data.frames into factors. Uses R code to do the conversion to ensure consistancy with native implementation.
    Attach dimensions and dimnames to data.frames to allow R functions that expect such things to work (e.g. and as.matrix()).
    Ensure tuplestore still gets created even for NULL/Nil results -- otherwise Postgres backend complains.
    Fix get_frame_tuplestore to deal properly with factor columns.
    Rename throw_pg_error to throw_pg_notice (since that's what it really did). Create real throw_pg_error function in case someone wants to really throw an error from R, but use throw_pg_notice when trapping R errors (similar behavior as before)
    Continued hacking on documentation.
Commits on Feb 7, 2003
  1. adjusted memory contexts throughout

    postgres authored
    eliminated use of free, and malloc in favor of pfree and palloc
    added use of non-exported R function, R_PreserveObject, to pin compiled function in memory and prevent garbage collection from grabbing from under me. Now cached compiled functions no longer mysteriously disappear!
Commits on Feb 5, 2003
  1. Improved handling of NULLs/NAs

    postgres authored
    Changed License to BSD in hopes that it will work out that way.
    Split up pg_get_r into seperate pg_scalar_get_r, pg_array_get_r, and pg_tuple_get_r_frame functions. Improved abstraction and reuse of conversion functions.
    Fixed bug in get_tuplestore when fcinfo->resultinfo was not set (i.e. when function run in targetlist instead of as a table function).
    Added special case handling for NAMEOID datatype -- looks like an array but treat like a scalar.
    Added regression test cases for null agument handling and tuple argument handling.
    Added ability to handle tuple arguments.
Commits on Feb 4, 2003
  1. Modified attribution a bit. Changed a few function names to improve c…

    postgres authored
    …onsistancy of style.
Commits on Feb 3, 2003
  1. Fixed PROTECT/UNPROTECT related bug causing execution of prepared que…

    postgres authored
    …ry to fail.
    Added macros to override R PROTECT/UNPROTECT as a debug aid; ifdef'd out but left for future use.
    Added lastoid function.
    Modified installed R functions to avoid '_' characters in the function names and added test cases for prepared queries and lastoid.
Commits on Feb 2, 2003
  1. Somehow got windows EOLs (CRLF) in some of the files. Purged them in …

    postgres authored
    …favor of Unix EOLs (LF)
Something went wrong with that request. Please try again.