From 7ba0f3bda110d9a23eaca22811166af1c7f48af1 Mon Sep 17 00:00:00 2001 From: barclay-osborne <44069524+barclay-osborne@users.noreply.github.com> Date: Sat, 27 Oct 2018 16:33:49 +0100 Subject: [PATCH] Some grammar etc fixes I've attempted to fix a few grammar type errors and make some things more standard throughout. Hope this helps! --- index.html | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index c07201b..959439e 100644 --- a/index.html +++ b/index.html @@ -138,7 +138,7 @@
Updating PL/v8 is usually straightforward as it is a small and stable extension
+Updating PLV8 is usually straightforward as it is a small and stable extension
When this command is executed, PostgreSQL tracks which objects belong to the
extension and conversely removes them upon uninstallation, i.e., whenever
DROP EXTENSION
is called.
You can explore some of the objects that PL/v8 stores under PostgreSQL:
+You can explore some of the objects that PLV8 stores under PostgreSQL:
=# SELECT lanname FROM pg_catalog.pg_language WHERE lanname = 'plv8';
=# SELECT proname FROM pg_proc p WHERE p.proname LIKE 'plv8%';
=# SELECT typname FROM pg_catalog.pg_type WHERE typname LIKE 'plv8%';
@@ -168,7 +168,7 @@
Runtime Environment Separation
In PLV8, each session has one global JS runtime context. This enables function
invocations at low cost, and sharing common object among the functions. However,
-for the security reasons, if the user switches to another with SET ROLE command,
+for security reasons, if the user switches to another with SET ROLE command,
a new JS runtime context is initialized and used separately. This prevents the
risk of unexpected information leaking.
Each plv8
function is invoked as if the function is the property of other
@@ -183,18 +183,18 @@
Start-up Procedure
-
PLV8 provides a start up facility, which allows you to call a plv8
runtime
+
PLV8 provides a start-up facility, which allows you to call a plv8
runtime
environment initialization function specified in the GUC variable. This can
only be set by someone with administrator access to the database you are
accessing.
SET plv8.start_proc = 'plv8_init';
SELECT plv8_test(10);
-
If this variable is set when the runtime is initialized, before the function
-call of plv8_test()
another plv8
function plv8_init()
is invoked. In such
-initialization function, you can add any properties to plv8
object to expose
+
If this variable is set when the runtime is initialized, before
+plv8_test()
runs another plv8
function plv8_init()
is invoked. In such
+an initialization function, you can add any properties to the plv8
object to expose
common values or assign them to the this property. In the initialization function,
the receiver this is specially pointing to the global object, so the variables
-that are assigned to the this property in this initialization are visible from
+that are assigned to this property in this initialization are visible from
any subsequent function as global variables.
Remember CREATE FUNCTION
also starts the plv8
runtime environment, so make
sure to SET
this GUC before any plv8
actions including CREATE FUNCTION
.
v8
available (6.4.388.40 or above), you can compile it against a
shared module:
$ make -f Makefile.shared
-
| Note: If you have multiple versions of PostgreSQL installed like 9.5 and 9.6, Plv8 will only be built for PostgreSQL 9.6. This is because make calls pg_config to get the version number, which will always be the latest version installed. If you need to build Plv8 for PostgreSQL 9.5 while you have 9.6 installed pass make the PG_CONFIG variable to your 9.5 version of pg_config. This works for make
, make -f Makefile.shared
, and make install
. For example in Ubuntu:
| Note: If you have multiple versions of PostgreSQL installed like 9.5 and 9.6, PLV8 will only be built for PostgreSQL 9.6. This is because make calls pg_config to get the version number, which will always be the latest version installed. If you need to build PLV8 for PostgreSQL 9.5 while you have 9.6 installed pass make the PG_CONFIG variable to your 9.5 version of pg_config. This works for make
, make -f Makefile.shared
, and make install
. For example in Ubuntu:
$ make PG_CONFIG=/usr/lib/postgresql/9.5/bin/pg_config
Plv8 allows you to optionally build with an execution timeout for Javascript +
PLV8 allows you to optionally build with an execution timeout for Javascript functions, when enabled at compile-time.
$ make EXECUTION_TIMEOUT=1
By default, the execution timeout is not compiled, but when configured it has a @@ -554,7 +554,7 @@
For the result and arguments, PostgreSQL types and Javascript types are mapped -automatically, if the desired PostgreSQL type is one of:
+automatically; if the desired PostgreSQL type is one of:OID
bool
These are only annotations that tell PLV8 to use the fast access method instead
of the regular one. For these typed arrays, only 1-dimensional arrays without
-any NULL
elements. There is currently no way to create such typed array inside
-PLV8 functions, only arguments can be typed array. You can modify the element and
+any NULL
elements are allowed. There is currently no way to create such typed array inside
+PLV8 functions; only arguments can be typed array. You can modify the element and
return the value. An example for these types are as follows:
CREATE FUNCTION int4sum(ary plv8_int4array) RETURNS int8 AS $
var sum = 0;
@@ -673,9 +673,9 @@
var func = plv8.find_function("callee");
return func(a);
$ LANGUAGE plv8;
-
With plv8.find_function()`
, you can look up other PLV8 functions. If they
-are not a PLV8 function, and error is thrown. The function signature parameter
-to plv8.find_function()`
is either of regproc
(function name only) or
+
With plv8.find_function()
, you can look up other PLV8 functions. If they
+are not a PLV8 function, an error is thrown. The function signature parameter
+to plv8.find_function()
is either of regproc
(function name only) or
regprocedure
(function name with argument types). You can make use of the
internal type for arguments and void type for return type for the pure Javascript
function to make sure any invocation from SQL statements should not occur.
If one of the SQL execution in the subtransaction block fails, all of operations +
If one of the SQL executions in the subtransaction block fails, all of operations
within the block are rolled back. If the process in the block throws a Javascript
exception, it is carried forward. So use a try ... catch
block to capture it and
do alternative operations if it occurs.
WindowObject.get_partition_local
WindowObject.get_partition_local([ size ])
Returns partition-local value, which is released at the end of the current
-partition. If nothing is stored, undefined is returned. size argument (default
+partition. If nothing is stored, undefined is returned. size
argument (default
1000) is the byte size of the allocated memory in the first call. Once the memory
is allocated, the size will not change.
WindowObject.set_partition_local
WindowObject.set_partition_local(obj)
Stores the partition-local value, which you can retrieve later with
-get_partition_local()`
. This function internally uses JSON.stringify()
to\
+get_partition_local()
. This function internally uses JSON.stringify()
to
serialize the object, so if you pass a value that is not able to be serialized
it may end up being an unexpected value. If the size of a serialized value is
more than the allocated memory, it will throw an exception.