Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Add plr_version() function: outputs a version string. Includes

  regression test changes -- docs to be done later with WINDOW docs.
  • Loading branch information...
commit d550f02687ed95e7ad8054e87320d621e062dd11 1 parent 6a9c69f
@jconway authored
View
7 expected/plr.out
@@ -3,6 +3,13 @@
-- does not depend on contents of plr.sql.
--
\set ECHO none
+-- check version
+SELECT plr_version();
+ plr_version
+-------------
+ 08.03.00.13
+(1 row)
+
-- make typenames available in the global namespace
select load_r_typenames();
load_r_typenames
View
12 pg_userfuncs.c
@@ -42,6 +42,18 @@ static ArrayType *plr_array_create(FunctionCallInfo fcinfo,
int numelems, int elem_start);
/*-----------------------------------------------------------------------------
+ * plr_version :
+ * output PL/R version string
+ *----------------------------------------------------------------------------
+ */
+PG_FUNCTION_INFO_V1(plr_version);
+Datum
+plr_version(PG_FUNCTION_ARGS)
+{
+ PG_RETURN_TEXT_P(PG_STR_GET_TEXT(PLR_VERSION));
+}
+
+/*-----------------------------------------------------------------------------
* reload_modules :
* interface to allow plr_modules to be reloaded on demand
*----------------------------------------------------------------------------
View
3  plr.h
@@ -33,6 +33,8 @@
#ifndef PLR_H
#define PLR_H
+#define PLR_VERSION "08.03.00.13"
+
#include "postgres.h"
#include "fmgr.h"
@@ -508,6 +510,7 @@ extern SEXP plr_SPI_lastoid(void);
extern void throw_r_error(const char **msg);
/* Postgres callable functions useful in conjunction with PL/R */
+extern Datum plr_version(PG_FUNCTION_ARGS);
extern Datum reload_plr_modules(PG_FUNCTION_ARGS);
extern Datum install_rcmd(PG_FUNCTION_ARGS);
extern Datum plr_array_push(PG_FUNCTION_ARGS);
View
5 plr.sql.in
@@ -6,6 +6,11 @@ AS 'MODULE_PATHNAME' LANGUAGE C;
CREATE LANGUAGE plr HANDLER plr_call_handler;
+CREATE OR REPLACE FUNCTION plr_version ()
+RETURNS text
+AS 'MODULE_PATHNAME','plr_version'
+LANGUAGE 'C';
+
CREATE OR REPLACE FUNCTION reload_plr_modules ()
RETURNS text
AS 'MODULE_PATHNAME','reload_plr_modules'
View
3  sql/plr.sql
@@ -6,6 +6,9 @@
\i plr.sql
\set ECHO all
+-- check version
+SELECT plr_version();
+
-- make typenames available in the global namespace
select load_r_typenames();
Please sign in to comment.
Something went wrong with that request. Please try again.