plv8

Can't create extensions plv8 postgresql

╄→гoц情女王★ 提交于 2021-02-07 20:40:16
问题 After install postgres, can't create extension plv8. I'm use: CREATE EXTENSION plv8; I'm getting: ERROR: could not open extension control file "/usr/local/share/postgresql/extension/plv8.control": No such file or directory ********** Error ********** ERROR: could not open extension control file "/usr/local/share/postgresql/extension/plv8.control": No such file or directory SQL state: 58P01 version postgres: 9.6.2 version pgAdmin4: 1.4 How to install plv8? 回答1: This should work on most

Can't create extensions plv8 postgresql

こ雲淡風輕ζ 提交于 2021-02-07 20:39:15
问题 After install postgres, can't create extension plv8. I'm use: CREATE EXTENSION plv8; I'm getting: ERROR: could not open extension control file "/usr/local/share/postgresql/extension/plv8.control": No such file or directory ********** Error ********** ERROR: could not open extension control file "/usr/local/share/postgresql/extension/plv8.control": No such file or directory SQL state: 58P01 version postgres: 9.6.2 version pgAdmin4: 1.4 How to install plv8? 回答1: This should work on most

Does PLV8 support making http calls to other servers?

左心房为你撑大大i 提交于 2020-01-14 14:17:59
问题 If I write a function for PostgreSql using PLV8, can I call an url with a get/post request from my PLV8 function? 回答1: No, according to this page and my understanding of "trusted": PL/v8 is a trusted procedural language that is safe to use, fast to run and easy to develop, powered by V8 JavaScript Engine. 回答2: No, as explained by Milen; use an untrusted PL like PL/perlu, PL/pythonu, PL/javau, etc. Doing this has the same problem as sending email from a trigger, in that unexpected issues like

plv8 disadvantages or limitations?

一曲冷凌霜 提交于 2020-01-03 09:09:12
问题 I'm playing around with PLV8 to write trigger and stored procedures for PostgreSQL. So far I don't really see disadvantages compared to PLPGSQL. Especially if working with JSON it seems even smarter then PLPGSQL. Are there known disadvantages or limitations if using PLV8? Can PLV8 be a full replacement for PLPGSQL? It would be great if somebody could share his experience on this. 回答1: The advantages and disadvantages of PLV8 are same as advantages and disadvantages of PLPerl, PLPython and

It's possible to call functions in another schema from within plv8 functions?

你说的曾经没有我的故事 提交于 2019-12-24 02:24:02
问题 I'm trying to use plv8 to write postgres functions. Now I would like to use the pgcrypt library in a way like this: CREATE OR REPLACE FUNCTION v01.myfunction(arg json) RETURNS json AS $BODY$ var res; res = obj.crypt(arg.password, res); plv8.elog(NOTICE, res); ... $BODY$ LANGUAGE plv8; Where crypt comes with the pgcrypt library and is find in another schema. But if running I get the error: ERROR: ReferenceError: obj is not defined Any idea? Thanks! 回答1: It's possible to call other PLV8

Can plv8 JavaScript language extension call 3rd party libraries?

↘锁芯ラ 提交于 2019-12-18 05:56:12
问题 In Postgresql, I want to call 3rd party libraries like moment.js or AWS lambda JS Client to invoke serverless functions from within the DB. I don't see any docs or examples how to do so: https://github.com/plv8/plv8/blob/master/README.md Is this possible and where can I find examples of how to 'import' or 'require' additional libraries? 回答1: The plv8 language is trusted so there is no way to load anything from the file system. However you can load modules from the database. Create a table

plv8 disable execute and prepare function in eval()

て烟熏妆下的殇ゞ 提交于 2019-12-13 19:14:31
问题 How could I deactivate the access to plv8 functions in my eval? create or replace function js(src text, input json) returns json as $$ plv8.elog(NOTICE, 'test'); //--plv8 = null; // this would disable permanently plv8, also after another call of the function var evalRes = eval('var output=null; ' + src + '; output;'); return JSON.stringify(evalRes); $$ LANGUAGE plv8; 回答1: I finally found the solution: create or replace function public.js(src text, input json) returns json as $$ //-- select js

Is it possible to create a re-usable function with the PostgreSQL plv8 extension?

依然范特西╮ 提交于 2019-12-13 15:16:40
问题 I wanted to drop in google's open location code javascript implementation into PostgreSQL (using the plv8 extension) and make it available to encode/decode from PostGIS geometry/geography data types. While I was successful, I wasn't able to work out how to only create a single function for the https://github.com/google/open-location-code/blob/master/js/src/openlocationcode.js file and I ended up putting a copy of that function into each function where I needed to encode/decode plus codes.

Store and index YAML with PostgreSQL, with Javascript lib or reusable functions?

元气小坏坏 提交于 2019-12-06 09:30:25
问题 PostgreSQL 9.2 has native JSON support. I'd like to store human readable config files, however, in YAML. And I think I'd like to index a few (but not all) of the config file values. Therefore I'm wondering: Is it's somehow possible to include [a third party Javascript library that parses Yaml] in Postgres, for example js-yaml. Then I could have my own YAML Javascript helper, in the same way as there's the built-in JSON helper in PostgreSQL 9.2. Alternatively: is it possible to declare

Store and index YAML with PostgreSQL, with Javascript lib or reusable functions?

我们两清 提交于 2019-12-04 15:28:20
PostgreSQL 9.2 has native JSON support. I'd like to store human readable config files, however, in YAML. And I think I'd like to index a few (but not all) of the config file values. Therefore I'm wondering: Is it's somehow possible to include [a third party Javascript library that parses Yaml] in Postgres, for example js-yaml . Then I could have my own YAML Javascript helper, in the same way as there's the built-in JSON helper in PostgreSQL 9.2. Alternatively: is it possible to declare individual reusable Javascript functions? If so, then I could add my own YAML parsing functions (based on