forked from knu/postgresql-plruby
/
README.en
129 lines (79 loc) · 3.72 KB
/
README.en
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
PL/Ruby is a loadable procedural language for the Postgres database
system that enable the Ruby language to create functions and trigger
procedures
This version can be compiled for the new interface of fmgr
(Postgresql > 7.0.2 : postgresql.snapshot.tar.gz). The language must
be 'newC' in this case
* Prerequisite
ruby >= 1.4.4
source of postgresql (for some include files).
For PostgreSQL 7.2 the source is not required if all headers was installed.
Command (see INSTALL in the directory postgresql-7.2)
make install-all-headers
* Installation
ruby extconf.rb
make
make install
You may need to specify :
--with-pgsql-dir=<prefix for include and lib directories for PostgreSQL>
--with-pgsql-include=<include file directory for PostgreSQL>
--with-pgsql-lib=<library dir for PostgreSQL>
--with-pgsql-srcinc=<include file *from* the source of PostgreSQL>
pgsql-srcinc must contains, for example, the file catalog/pg_proc.h
(not needed if `make install-all-headers' was executed)
--with-pgsql-version=<release number for PostgreSQL, actually 65, 70, 71
or 72 i.e. major and minor number>
--enable-conversion
arguments for the function will be converted to Integer, Float, true,
false, Time, Tinterval or String depending of the internal type.
--enable-geometry
add the classes Point, Segment, Line, Box, Path, Polygon, Circle to
plruby (--enable-conversion is automatically added)
--enable-network
add the classes NetAddr, MacAddr to plruby (--enable-conversion
is automatically added)
--with_suffix=<suffix to add>
For example
ruby extconf.rb --enable_geometry --with-suffix=_geo
will create plruby_geo.so
Example :
ruby extconf.rb --with-pgsql-include=/usr/include/postgresql \
--with-pgsql-lib=/usr/lib \
--with-pgsql-srcinc=/var/postgres/postgresl-6.5/src/include
* Test (and examples)
WARNING : if plruby was compiled with --enable-conversion and $SAFE < 3
you must *FIRST* run `make install' before `make test'
make test
this will run the 2 commands :
( cd test/plt; ./runtest )
( cd test/plp; ./runtest )
The database plruby_test is created and then destroyed. Don't use it if
such a database exist on your system.
* Now create the PL/Ruby language in PostgreSQL
Since the pg_language system catalog is private to each database,
the new language can be created only for individual databases,
or in the template1 database. In the latter case, it is
automatically available in all newly created databases.
The commands to create the new language are:
create function plruby_call_handler () returns opaque
as 'path-to-plruby-shared-lib'
language 'C';
create trusted procedural language 'plruby'
handler plruby_call_handler
lancompiler 'PL/Ruby';
*** WARNING for PostgreSQL > 7.0.2 ***
for the new interface to fmgr, the language must be specified
as 'newC' rather than 'C'
*** WARNING for PostgreSQL >= 7.1.rc4 ***
the language must be specified as 'C' rather than 'newC'
The trusted keyword on create procedural language tells PostgreSQL,
that all users (not only those with superuser privilege) are
permitted to create functions with LANGUAGE 'plruby'. This is
absolutely safe, because there is nothing a normal user can do
with PL/Ruby, to get around access restrictions he/she has.
* Documentation : see plruby.rd and plruby.html
* Copying
This extension module is copyrighted free software by Guy Decoux
You can redistribute it and/or modify it under the same term as
Ruby.
Guy Decoux <ts@moulon.inra.fr>