Questions tagged [plv8]

A Javascript procedural language add-on for PostgreSQL

A procedural language add-on for PostgreSQL that embeds Google's v8 Javascript interpreter in the PostgreSQL RDBMS, allowing you to write native Javascript functions and stored procedures.

Project page: http://code.google.com/p/plv8js/

56 questions
27
votes
5 answers

Javascript serialization and performance with V8 and PostgreSQL

I have been experimenting with PostgreSQL and PL/V8, which embeds the V8 JavaScript engine into PostgreSQL. Using this, I can query into JSON data inside the database, which is rather awesome. The basic approach is as follows: CREATE or REPLACE…
Toby Hede
  • 36,755
  • 28
  • 133
  • 162
9
votes
3 answers

Can plv8 JavaScript language extension call 3rd party libraries?

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…
Jason
  • 2,006
  • 3
  • 21
  • 36
8
votes
3 answers

plv8 disadvantages or limitations?

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…
Rainer
  • 1,067
  • 2
  • 14
  • 29
6
votes
3 answers

Can't create extensions plv8 postgresql

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…
user7936684
5
votes
1 answer

plv8 stored procedure with jsonb type

This may be premature, postgres 9.4 is still in beta. I've been experimenting with the jsonb type. I am not having any luck passing a jsonb type to a plv8 function, it comes in as type string. I was wondering if I was doing it wrong? create or…
Greg
  • 6,571
  • 2
  • 27
  • 39
5
votes
2 answers

How to get value of a variable in plv8 without using plv8.elog()?

I am having an issue with getting correct output from plv8.elog(). Just to start, I'm using PostgreSQL 9.2, plv8 1.4.1 as installed by pgxn, on Ubuntu 12.10. I have a function I am building that includes nested cursor loops and uses a number of…
Jordan
  • 711
  • 1
  • 6
  • 12
4
votes
1 answer

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

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…
Jay Cummins
  • 1,039
  • 2
  • 14
  • 31
4
votes
2 answers

Does PLV8 support making http calls to other servers?

If I write a function for PostgreSql using PLV8, can I call an url with a get/post request from my PLV8 function?
mahonya
  • 9,247
  • 7
  • 39
  • 68
3
votes
0 answers

Huge SQL query inside PLV8 function

In my PostgreSQL-9.6-database, for better or worse, there are a lot of PLV8 functions. Some of our DB business logic simply has to be done in JavaScript. However, inside these PLV8 functions there are a lot of database queries in vanilla SQL. That's…
cis
  • 1,259
  • 15
  • 48
3
votes
1 answer

Debugging PLV8 in PostgreSQL

Some time ago I asked for disadvantages of using PLV8 within PostgreSQL Functions and Triggers. In the meantime I use a mixed szenario with plpgSQL and love it. But - as mentioned - debugging has less options with PLV8. So far I understand the…
Rainer
  • 1,067
  • 2
  • 14
  • 29
3
votes
0 answers

Loading Node Modules in Postgresql (PLV8)

I'm following [this article (http://adpgtech.blogspot.com.br/2013/03/loading-useful-modules-in-plv8.html) for loading Node modules into Postgres PLV8. It works, except for getting the plv8_startup() function to run when Postgres starts up. I'm…
jdixon04
  • 1,435
  • 16
  • 28
3
votes
2 answers

Postgres PLV8 function with 'RETURNS TABLE' throws 'ERROR: ReferenceError: $1 is not defined'

Trying to return table from PLV8 stored procedure. It fails to recognize input args i.e. $1 when the function is with RETURNS TABLE(...). It works when function returns scalars: psql# CREATE OR REPLACE function foo(integer) RETURNS integer …
Thalis K.
  • 7,363
  • 6
  • 39
  • 54
3
votes
0 answers

Postgres plv8 - custom error - lose custom properties

Custom error lose custom properties What steps will reproduce the problem: create function CREATE OR REPLACE FUNCTION public.utils () RETURNS void AS $body$ this.dbError = function(message){ this.message = (message || ''); }; dbError.prototype…
user2627000
  • 317
  • 1
  • 2
  • 10
3
votes
1 answer

PostgreSQL: plv8.start_proc

Set up startup procedure in config plv8.start_proc = 'plv8_startup' Created function: CREATE OR REPLACE FUNCTION plv8_startup () RETURNS void AS $body$ this.hello = function(name){ return name + ', hello!'; }; $body$ LANGUAGE…
user2627000
  • 317
  • 1
  • 2
  • 10
3
votes
1 answer

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

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…
KajMagnus
  • 11,308
  • 15
  • 79
  • 127
1
2 3 4