4
>PostgreSQL Support Functions</TITLE
7
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
12
TITLE="PL/R User's Guide - R Procedural Language"
13
HREF="index.html"><LINK
15
TITLE="Database Access and Support Functions"
16
HREF="plr-spi-rsupport-funcs.html"><LINK
18
TITLE="Aggregate Functions"
19
HREF="plr-aggregate-funcs.html"><LINK
22
HREF="stylesheet.css"><META
24
CONTENT="2003-08-25T17:44:28"></HEAD
35
SUMMARY="Header navigation table"
44
>PL/R User's Guide - R Procedural Language</TH
52
HREF="plr-spi-rsupport-funcs.html"
66
HREF="plr-aggregate-funcs.html"
79
NAME="PLR-PGSQL-SUPPORT-FUNCS"
81
>Chapter 7. PostgreSQL Support Functions</H1
83
> The following commands are available to use in PostgreSQL queries
84
to aid in the use of PL/R functions:
107
> Install R code, given as a string, into the interpreter. See
109
HREF="plr-global-data.html"
117
>reload_plr_modules</TT
122
> Force re-loading of R code from the <TT
126
table. It is useful after modifying the contents of
130
>, so that the change will have an
137
>plr_singleton_array</TT
150
> Creates a new PostgreSQL array, using element
156
>. This function is predefined
157
to accept one float8 value and return a float8 array. The C function
158
that implements this PostgreSQL function is capable of accepting and
159
returning other data types, although the return type must be an array
160
of the input parameter type. It can also accept multiple input
161
parameters. For example, to define a <TT
165
function to create a text array from two input text values:
167
CLASS="PROGRAMLISTING"
168
>CREATE OR REPLACE FUNCTION plr_array (text, text)
170
AS '$libdir/plr','plr_array'
171
LANGUAGE 'C' WITH (isstrict);
173
select plr_array('hello','world');
207
> Pushes a new element onto the end of an existing PostgreSQL array.
208
This function is predefined to accept one float8 array and a float8
209
value, and return a float8 array. The C function that implements this
210
PostgreSQL function is capable of accepting and returning other data
211
types. For example, to define a <TT
215
function to add a text value to an existing text array:
217
CLASS="PROGRAMLISTING"
218
>CREATE OR REPLACE FUNCTION plr_array_push (_text, text)
220
AS '$libdir/plr','plr_array_push'
221
LANGUAGE 'C' WITH (isstrict);
223
select plr_array_push(plr_array('hello','world'), 'how are you');
225
-----------------------------
226
{hello,world,"how are you"}
257
> Creates a new array using <TT
268
> is NULL. Otherwise, pushes
280
>. This function is predefined
281
to accept one float8 array and a float8 value, and return a float8
282
array. The C function that implements this PostgreSQL function is
283
capable of accepting and returning other data types. For example,
288
int4 value to an existing int4 array:
290
CLASS="PROGRAMLISTING"
291
>CREATE OR REPLACE FUNCTION plr_array_accum (_int4, int4)
293
AS '$libdir/plr','plr_array_accum'
296
select plr_array_accum(NULL, 42);
301
select plr_array_accum('{23,35}', 42);
308
This function may be useful for creating custom aggregates. See
310
HREF="plr-aggregate-funcs.html"
318
>load_r_typenames</TT
322
> Installs datatype Oid variables into the R interpreter
323
as globals. See also <TT
336
> Displays the datatype Oid variables installed into the R interpreter
338
HREF="plr-spi-rsupport-funcs.html"
350
> Displays the environment under which the Postmaster is currently
351
running. This may be useful to debug issues related to R specific
352
environment variables. This function is installed with EXECUTE
353
permission revoked from PUBLIC.
364
SUMMARY="Footer navigation table"
375
HREF="plr-spi-rsupport-funcs.html"
393
HREF="plr-aggregate-funcs.html"
403
>Database Access and Support Functions</TD
413
>Aggregate Functions</TD
b'\\ No newline at end of file'