Git Product home page Git Product logo

plv8's Introduction

PLV8 - A Procedural Language in Javascript powered by V8

PLV8 is a shared library that provides a PostgreSQL procedural language powered by V8 Javascript Engine. With this program you can write in Javascript your function that is callable from SQL.

Support

There is a Discord available for general questions and support. Please ask there before opening an issue.

Build Requirements

Note that as PLV8 3.2, build requirements have again changed.

Linux

The following packages must be installed to build on Ubuntu or Debian:

  • libtinfo5
  • build-essential
  • pkg-config
  • libstdc++-12-dev (depending on version, may be 10 instead of 12)
  • cmake
  • git

The following packages must be installed to build on EL9 or EL8:

  • 'development tools' - via groupinstall
  • cmake
  • git

MacOS

The following packages must be install to build on MacOS:

  • XCode - and the command line tools
  • cmake

Building

Building plv8 needs to have all build requirements fulfilled before building. You must make sure that pg_config is in your path. It should share the same installation directory as psql and postgres.

make

Installing

This should install plv8 as an available extension into Postgres.

make install

Run Tests

Postgres features a test runner, and plv8 includes a number of tests that can be run.

make installcheck

Running

=# CREATE EXTENSION plv8;

This will install PLV8 into your database if it exists as an available extension.

Testing

To test, you can execute:

=# DO $$ plv8.elog(NOTICE, "hello there!"); $$ LANGUAGE plv8;

For full documentation, see https://plv8.github.io/.

Docker

For Docker support, see ./platforms/Docker/README.md

plv8's People

Contributors

adunstan avatar asah avatar audreyt avatar ayan4m1 avatar bendiy avatar bnoordhuis avatar car3ca avatar clkao avatar deinspanjer avatar donsergioq avatar haradh1 avatar hellower avatar itgacky avatar jeffcoat avatar jerrysievert avatar johnhvancouver avatar johnzzw avatar juniorrojas avatar kelvich avatar kokizzu avatar malakhite avatar niblings avatar pkit avatar schwebke avatar sfingram avatar theory avatar tmr08c avatar umitanuki avatar xsacha avatar zxdvd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plv8's Issues

Can't make install in os x lion

What steps will reproduce the problem?
1. brew install v8
2. make install
3.

What is the expected output? What do you see instead?
g++ -O2 -pthread -Wall -Wmissing-prototypes -Wpointer-arith 
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute 
-Wformat-security -fno-strict-aliasing -fwrapv  -bundle -multiply_defined 
suppress -o plv8.so plv8.o plv8_type.o plv8_func.o plv8_param.o coffee-script.o 
-L/usr/local/lib -Wl,-dead_strip_dylibs    -lv8 -bundle_loader 
/usr/local/bin/postgres
Undefined symbols for architecture x86_64:
  "_DirectFunctionCall1", referenced from:
      find_js_function_by_name(char const*) in plv8.o
      ToScalarValue(unsigned long, bool, plv8_type*) in plv8_type.o
      ToScalarDatum(v8::Handle<v8::Value>, bool*, plv8_type*)  in plv8_type.o
      quote_literal_cstr(char const*) in plv8_func.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [plv8.so] Error 1


What version of the product are you using? On what operating system?
 os x 10.7

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 30 Oct 2012 at 9:51

Need separate context per user

Currently we have one global context. But this has been deemed a security issue 
in other PLs because of the possibility of redefinition of global objects 
affecting  Security Definer functions. For PLV8 I think we need a per-user 
context allocated and stashed inside GetGlobalContext().

Original issue reported on code.google.com by [email protected] on 10 Nov 2011 at 4:12

Refactor dialect support code

In the issue #35, we added LiveScript suuport.  However, in order to support 
more dialects around JavaScript, we need more sanity way to add them.

One of the main concerns is the build system.  Maybe we can include every 
dialect in the all rule, and for the people who want only plv8 we can supply a 
plv8 build rule.

Original issue reported on code.google.com by [email protected] on 16 Sep 2012 at 4:13

Modify NEW in triggers

Support to modify NEW in triggers. Why haven't we support it though we have 
trigger support?

Original issue reported on code.google.com by [email protected] on 3 Feb 2012 at 10:31

Need cursor support

We need to make sure that we don't have to materialize a whole result set from 
Execute SQL in memory. The best way to do that is with cursor support. A 
preliminary sketch of the API I have done is:

extern v8::Handle<v8::Value> CreateSqlPlan(const v8::Arguments& args) throw();
extern v8::Handle<v8::Value> FreeSqlPlan(const v8::Value& arg) throw();

extern v8::Handle<v8::Value> CreateSqlCursor(const v8::Arguments& args) throw();
extern v8::Handle<v8::Value> FetchSqlCursor(const v8::Value& arg) throw();
extern v8::Handle<v8::Value> CloseSqlCursor(const v8::Value& arg) throw();

To make this work we'll need to move the calls to SPI_Connect() andf 
SPI_finish()  out to where they surround the outer JS function call.

We can also cache the cursor if need be to the end of the transaction. 

Original issue reported on code.google.com by [email protected] on 22 Sep 2011 at 8:50

Please tag a release version

I'm working with the popular OS X packaging tool homebrew to include plv8 
(https://github.com/mxcl/homebrew/pull/10114)

One concern they raised was that there isn't a tagged version number.

Could we please get 1d69da3c36474943a8e2a68037b8f8ca5a102ea7 tagged with a 
version number of some sort?

Original issue reported on code.google.com by [email protected] on 13 Feb 2012 at 12:20

feature: long lived prepared statements

According to the docs, prepared statements must be free'd before leaving the 
function, this makes them useful only for statements that will be repeated in 
the same function.

A use case more common to our app is the need to optimize calling a function 
repeatedly so it would be nice to store the prepared statement in a lasting 
scope.

I am trying out the idea of putting the prepared statements in plv8.$prepared 
on init and not calling free.  This goes against the docs so I'm not sure what 
kind of trouble I'm seeking, but is seems to be working thus far.

Thanks

Original issue reported on code.google.com by [email protected] on 5 Jan 2013 at 8:40

Keep a table of plans rather than just handing the user a wrapped pointer

PLPerl keeps a hash table of query-desc objects and just hands the user an 
opaque name for the object, When the plan is used, it is looked up in the hash 
table and the actual plan pointer is retrieved. We need to do something 
similar. That way the user can't just hand us an arbitrary pointer and have us 
treat it as a plan pointer.

Original issue reported on code.google.com by [email protected] on 30 Oct 2011 at 1:43

[PATCH] Add LiveScript support with generalized "Dialect" enum

Hi! Attached please find patches from:

https://code.google.com/r/audreytang-plv8js-ls

That contains support for the ENABLE_LIVESCRIPT makefile flag, as well as the 
internal "Dialect" enum adjusted to support multiple JavaScript dialects.

Thank you for your great work in introducing CoffeeScript in the first place!

Original issue reported on code.google.com by [email protected] on 4 Sep 2012 at 5:28

Attachments:

Wrap and Unwrap are depricated in v8


Wrap and Unwrap are depricated in v8. It is recommended to use New, Cast and 
Value instead.

Included is a quick fix that worked with the newest v8, But I'm not a c/c++ 
coder so someone look through it. 

Made with Antti Jokipii.

Original issue reported on code.google.com by [email protected] on 31 Jan 2013 at 3:35

Attachments:

create function causes PostgreSQL session to crash on windows if typo in stored func

What steps will reproduce the problem?
1. CREATE OR REPLACE FUNCTION upsert_inventory(param_inv json) RETURNS
text AS $$
var o = JSON.parse(param_inv);
var uplan = plv8.prepare('UPDATE inventory 
    SET prod_name = $1, loc_id = $2 WHERE prod_code = $3', ['varchar', 'int', 'varchar'] );
var iplan = plv8.prepare('INSERT INTO inventory( prod_name, loc_id, prod_code)  
    VALUES($1, $2, $3', ['varchar', 'int', 'varchar'] );
var num_changed;
if (typeof ej != 'object')
   return NULL;
else {
    for(var i=0; i<o.length; i++){
      num_changed = uplan.execute(o[i]['prod_name'], o[i]['loc_id'], o[i]['prod_code']);
      if (num_changed == 0){ /** record does not exist add it **/
        iplan.execute(o[i]['prod_name'], o[i]['loc_id'], o[i]['prod_code']);
      }
    }
}
return 'done';
$$ LANGUAGE plv8 VOLATILE;

What is the expected output? Hmm it gives an error.

What do you see instead? Crashes my session.
NOTE:  If I change the statement to this it doesn't crash and saves fine.  The 
difference between the two is I have line breaks in my SQL statements in the 
crashing ones.
CREATE OR REPLACE FUNCTION upsert_inventory(param_inv json) RETURNS
text AS $$
var o = JSON.parse(param_inv);
var uplan = plv8.prepare('UPDATE inventory SET prod_name = $1, loc_id = $2 
WHERE prod_code = $3', ['varchar', 'int', 'varchar'] );
var iplan = plv8.prepare('INSERT INTO inventory( prod_name, loc_id, prod_code) 
VALUES($1, $2, $3', ['varchar', 'int', 'varchar'] );
var num_changed;
if (typeof ej != 'object')
   return NULL;
else {
    for(var i=0; i<o.length; i++){
      num_changed = uplan.execute(o[i]['prod_name'], o[i]['loc_id'], o[i]['prod_code']);
      if (num_changed == 0){ /** record does not exist add it **/
        iplan.execute(o[i]['prod_name'], o[i]['loc_id'], o[i]['prod_code']);
      }
    }
}
return 'done';
$$ LANGUAGE plv8 VOLATILE;

What version of the product are you using? On what operating system?
I compiled under mingw64 gcc 4.5.4.  I tested under both my mingw64 PostgreSQL 
build and the EDB PostgreSQL 9.2beta2 builds and both give the same problem.

Please provide any additional information below.

PostgreSQL 9.2beta2
Windows 7 64-bit (I tested on 32-bit EDB and 64-bit mingw built PostgreSQL 
(64-bit) )

The postgres logs show:

ERROR:  column "spclocation" does not exist at character 25
STATEMENT:  SELECT ts.oid, spcname, spclocation, spcoptions, 
pg_get_userbyid(spcowner) as spcuser, spcacl, pg_catalog.shobj_description(oid, 
'pg_tablespace') AS description FROM pg_tablespace ts
     ORDER BY spcname
terminate called after throwing an instance of 'js_error';


Using V8 compiled from trunk (Jul 15 2012 or so) and PL/V8 from git around Jul 
15 2012

I assume its something with the parser.  Note to compile plv8 I had to change 
SHLIB_LINK to (added stdc++)
SHLIB_LINK := $(SHLIB_LINK) -lv8 -lstdc++ 

as described
http://www.postgresonline.com/journal/archives/261-Building-PLV8JS-and-PLCoffee-
for-Windows-using-MingW64-w64-w32.html

so not sure if that is part of the issue.  I did leave setting to compile with 
g++ though.

Original issue reported on code.google.com by [email protected] on 21 Jul 2012 at 3:16

Binary build

I'd like to have binary builds in Windows (32/64), Mac (64), Linux (RHEL, 64) 
for the public release.

Original issue reported on code.google.com by [email protected] on 28 Apr 2012 at 9:08

TRIGGER: Can not cancel query by returning NULL

What steps will reproduce the problem?

With PL/pgSQL, returning NULL by BEFORE TRIGGER cancels query. However, PLV8 
doesn't cancel.

CREATE TABLE test (
  id SERIAL NOT NULL,
  txt TEXT,
  deleted BOOLEAN DEFAULT FALSE NOT NULL
);

CREATE OR REPLACE FUNCTION test_delete_trigger() RETURNS trigger AS $$
  return null; // Do not have any effect with PLV8
  // return; return ''; return 0; return false; are the same
$$ LANGUAGE plv8;

CREATE TRIGGER test_del BEFORE DELETE ON test FOR EACH ROW EXECUTE PROCEDURE 
test_delete_trigger();

insert into test (txt) values ('a');
insert into test (txt) values ('a');
insert into test (txt) values ('a');

delete from test where id = 1;
delete from test where id = 2;
delete from test where id = 3;


What is the expected output? What do you see instead?

Canceled query, but rows are deleted.



What version of the product are you using? On what operating system?

 MomongaLinux7 x86_64
   - gcc/g++ 4.4.4
   - glibc 2.12.90

 PostgreSQL 9.2.1 (ใ‚ฝใƒผใ‚น้…ๅธƒ็‰ˆ๏ผ‰
 V8 3.15.6.0 (src/version.cc) 
 PL/V8 1.3.0devel (plv8_config.h)




Please provide any additional information below.

Following PL/pgSQL function cancels query.

CREATE OR REPLACE FUNCTION test_delete_trigger() RETURNS trigger AS $$
  DECLARE
  BEGIN
  UPDATE test SET deleted = true WHERE id = OLD.id;
  return null; // Returning null cancel query with PL/pgSQL
  END;
$$ LANGUAGE plpgsql;


Original issue reported on code.google.com by [email protected] on 27 Nov 2012 at 5:35

Code review request

Branch name: subtran

Purpose of code changes on this branch:
Add subtransaction() to issue sub-transaction.

When reviewing my code changes, please focus on:
The change is WIP and I'll add tests etc.

After the review, I'll merge this branch into: master


Original issue reported on code.google.com by [email protected] on 20 Mar 2012 at 9:25

Shared data

pl/perl has $_SHARED and pl/python has SD/GD. I heard from someone that he 
wants to use something like them. I found plv8 can do it with "this" but am not 
sure if it should be used or such global variables should be supported. If yes, 
we need to take care of it and document it.

db1=# create function f() returns int as $$ if (!this.i) this.i = 0; this.i++; 
return this.i; $$ language plv8;
CREATE FUNCTION
db1=# select f();
 f 

---
 1
(1 row)

db1=# select f();
 f 

---
 2
(1 row)

db1=# select f();
 f 

---
 3
(1 row)

Original issue reported on code.google.com by [email protected] on 3 Feb 2012 at 10:29

select current_schemas(true) crashes

# do $$ plv8.execute("select current_schemas(true)") $$ language plv8;
The connection to the server was lost. Attempting reset: Failed.

expected:
# select current_schemas(true);
   current_schemas   
---------------------
 {pg_catalog,public}
(1 row)

Using plv8 latest trunk, postgres 9.1.3

Thanks

Original issue reported on code.google.com by [email protected] on 16 May 2012 at 5:07

plcoffee on Pg9.2

Hi,

We can't get plcoffee to work...

make ENABLE_COFFEE=1 install

passed well, without any problems...

make ENABLE_COFFEE=1 installcheck

passed - but noticed there are no test for plcoffee

create new DB,

CREATE EXTENSION (both, plv8 and plcoffee) passed well...

CREATE LANGUAGE - a bit unusual - for both says language already exists... 

plv8 functions - works fine (as DO)

CREATE FUNCTION in plcoffee breaks - without an error - just connection 
breaks...

The same happens and for DO statemebts:

DO LANGUAGE plcoffee
$$

$$

even it is empty... or not empty and no syntax error... just breaks 
connection...

The same happens in PgAdmin from client machine.. as on psql on the server...

Server: Ubuntu 1204
Pg: 9.2

plv8js - latest snapshot...

Any advice?

Thanks,

Misa

Original issue reported on code.google.com by [email protected] on 25 Sep 2012 at 12:30

Extension hangs on FreeBSD

I am using

 - PostgreSQL 9.2 RC1
 - V8 3.13.3.1
 - PL/V8 (from https://code.google.com/p/plv8js/)

As a baseline, I am able to build and run all above as expected on Ubuntu 10.04 
LTS i386.

Now, all of the following give the same behavior: as soon as I create a 
function (or run make installcheck), the PG client will /hang forever/.

Tested:

 - FreeBSD 9 Rel. : i386 and AMD64
 - GCC 4.2.1 (from system) and GCC 4.6.2 (from ports collection)
 - PostgreSQL 9.1.5 and 9.2 RC1

I have run the V8 regression tests for all builds successfully (100% green). So 
the V8 library itself seems to be working. PG for itself I assume is also not 
the problem (I tested 9.1.5 also).

Original issue reported on code.google.com by [email protected] on 27 Aug 2012 at 4:24

Support JSON type in 9.2

Because json is a built-in type in 9.2, it is a reasonable request that plv8 
converts the in/out value automatically.  Not sure how difficult upgrade would 
be.  This may be beneficial when js function that takes js object is called via 
fin_function.

Original issue reported on code.google.com by [email protected] on 29 Nov 2012 at 8:22

"REPLACE" doesn't work

CREATE OR REPLACE FUNCTION v8repl(text, int) RETURNS text AS $$
  var buf = [];
  for(var i = 0; i < $2; i++){
    buf.push( $1 );
  }
  return buf.join( "," );
$$ LANGUAGE plv8;

SELECT v8repl('test', 10);

CREATE OR REPLACE FUNCTION v8repl(text, int) RETURNS text AS $$
  var buf = [];
  for(var i = 0; i < $2; i++){
    buf.push( $1 );
  }
  return buf.join( "-" );
$$ LANGUAGE plv8;

SELECT v8repl('test', 10);

CREATE FUNCTION
                      v8repl
---------------------------------------------------
 test,test,test,test,test,test,test,test,test,test
(1 row)

CREATE FUNCTION
                      v8repl
---------------------------------------------------
 test,test,test,test,test,test,test,test,test,test
(1 row)

=====

Actually, the second result is wrong.


Original issue reported on code.google.com by [email protected] on 28 Aug 2010 at 5:44

V8_SRCDIR option disappeared


It looks like the V8_SRCDIR option disappeared in 
90190dc310d1c460dfb510c9e30925cc7575d836. I was using that :)

Original issue reported on code.google.com by [email protected] on 20 Dec 2012 at 5:40

Reset plv8 for all sessions on a server

How can I signal plv8 to reinitialize or de-initialize for all sessions, like 
issuing \c from psql?

pg docs has an alter database reset: 
http://www.postgresql.org/docs/9.1/static/sql-alterdatabase.html

But this does not reset plv8.

The use case for this is deploying new/updated code.  It's a bummer to have to 
restart the entire database server.

Original issue reported on code.google.com by [email protected] on 30 May 2012 at 4:50

Latest plv8js doesn't build with latest v8 trunk

What steps will reproduce the problem?
I'm running on mingw, but I think the issue is really incompatibility with
plv8 and v8 trunk.  Perhaps a non-issue since v8 trunk is technically not 
stable yet
I was able to build and test fine with the recommended v8 3.14.5

1. building with v8 (http://v8.googlecode.com/svn/trunk) r13185 December 10th
2. compile plv8 1.3.0 tagged version

What is the expected output? 
It compiles

What do you see instead?
plv8.o:plv8.cc:(.text+0x106f): undefined reference to 
`v8::Object::SlowGetInternalField(int)'

What version of the product are you using? On what operating system?
postgresql 9.2, mingw64-w32, windows 7



Original issue reported on code.google.com by [email protected] on 11 Dec 2012 at 3:22

README for PGXN

Write adequate amount of document in README, which will be helpful when we 
upload to PGXN.

Original issue reported on code.google.com by [email protected] on 28 Apr 2012 at 9:07

date conversion regression failure

What steps will reproduce the problem?

Make installcheck 

What is the expected output? What do you see instead?

instead of success, this failure:


*** /home/andrew/plv8js/expected/plv8.out   2011-09-10 15:35:14.000000000 -0400
--- /home/andrew/plv8js/results/plv8.out    2011-09-22 18:33:18.088773716 -0400
***************
*** 153,159 ****
  SELECT text_to_date('23 Dec 2010 GMT');
   text_to_date 
  --------------
!  12-23-2010
  (1 row)

  CREATE FUNCTION oidfn(id oid) RETURNS oid AS $$ return id $$ LANGUAGE plv8;
--- 153,159 ----
  SELECT text_to_date('23 Dec 2010 GMT');
   text_to_date 
  --------------
!  05-02-474040
  (1 row)

  CREATE FUNCTION oidfn(id oid) RETURNS oid AS $$ return id $$ LANGUAGE plv8;




Looks like it's probably an issue in EpochToDate()


Original issue reported on code.google.com by [email protected] on 22 Sep 2011 at 11:04

yielding non-record causes core dump

What steps will reproduce the problem?

 create or replace function xxx(n int) returns setof record language plv8 as 
    $x$ var i; for (i=0; i<n; i++) yield(i*2); $x$;
 select * from xxx(3) as x(n int);

What is the expected output? 

  error

What do you see instead?

  The connection to the server was lost. Attempting reset: Failed



Original issue reported on code.google.com by [email protected] on 30 Oct 2011 at 10:06

failed executeSql() causes "ERROR: SPI_finish() failed"

-----------------
CREATE OR REPLACE FUNCTION spi_test() RETURNS int AS $$
try{
  executeSql('ERROR;');
}catch (e){
  print(NOTICE, 'catch');
}
$$ LANGUAGE plv8 IMMUTABLE STRICT;

SELECT spi_test();
-----------------

Result:
----------
NOTICE:  catch
ERROR:  SPI_finish() failed
---------------

* What version of the product are you using? On what operating system?

postgresql - 9.0.4
plv8js - Changeset 23:bd6caea027c4  (Sat Oct 29 14:02:03 2011 -0400)

Original issue reported on code.google.com by [email protected] on 10 Nov 2011 at 1:16

try/catch/return crashes postgres server

What steps will reproduce the problem?

returning a value from a try/catch with a js error works as expected, however 
if the error is caused by postgres, returning a value crashes the server.  To 
reproduce, run the below example -- NOTE: it will crash postgres

CREATE OR REPLACE function plv8_dump() returns text language plv8 as
$JS$
   /* this works: returns: "error: oneBadFunc is not defined"
   try {
     oneBadFunc();
   } catch(e) {
     return "error: "+e.message;
   }
   */
   /* this brings down entire server */
   try {
     plv8.execute("SELECT * FROM null_table WHERE ",[8]);
   } catch(e) {
     // throw e;   //<-- does not crash
     return "error: "+e.message;
   }
$JS$;                  

What version of the product are you using? On what operating system?
postgres: 9.2.1, plv8 1.3.0devel

Also commented, but if the error is thrown in the catch postgres will not die

Original issue reported on code.google.com by [email protected] on 5 Jan 2013 at 7:51

remote debugger: FATAL: BeginInternalSubTransaction: unexpected state DEFAULT

What steps will reproduce the problem?
1. connect to plv8 with d8: /d8 --remote-debugger --debugger_port=35432
2. issue any sql statement: plv8.execute("select 1==1"); 

result: (pg backend crash)
FATAL:  BeginInternalSubTransaction: unexpected state DEFAULT

What version of the product are you using? On what operating system?
plv8 1.3.0, pg 9.2.2 OS X 10.8.2

googled it and found: 
http://postgresql.1045698.n5.nabble.com/backend-crash-with-FATAL-BeginInternalSu
bTransaction-unexpected-state-END-td2123467.html

Beyond my debugging skills, but I guess because I'm not in an sql function than 
the current transaction is in a non-supported state.  I tried to 
plv8.execute("BEGIN") but that didn't help either.

Original issue reported on code.google.com by [email protected] on 15 Jan 2013 at 7:38

Add V8 debugger support

Starting the V8 debugger will make it listen on a specified TCP port. Hence the 
PG server process will continue to talk to the PG client on it's own port, but 
additionally talk on the V8 debug port to a V8 debugger that attached.

http://code.google.com/p/v8/wiki/AddDebuggerSupport

Original issue reported on code.google.com by [email protected] on 26 Sep 2012 at 9:47

Complete ExecutePlan()

Currently it's a placeholder, but we should be able to execute a saved plan 
without having to use a cursor.

Original issue reported on code.google.com by [email protected] on 27 Apr 2012 at 3:13

select array(..) does not convert array contents to json

create table arraytest(id int, value text);
insert into arraytest values(1,'one');
insert into arraytest values(2,'two');

Selecting the table returns an array, with the table properly converted to JSON:

DO language plv8 'print(NOTICE,JSON.stringify(executeSql("select arraytest json 
from arraytest")))';
-> NOTICE:  [{"json":{"id":1,"value":"one"}},{"json":{"id":2,"value":"two"}}]

Same query, only selecting it as an array, returns an array of strings:

DO language plv8 'print(NOTICE,JSON.stringify(executeSql("select array(select 
arraytest from arraytest) json")))';
-> NOTICE:  [{"json":["(1,one)","(2,two)"]}]


Original issue reported on code.google.com by [email protected] on 20 Mar 2012 at 9:19

Map bytea, _int, _short, _float, etc to "external array"

v8 supports "external array" which makes v8 object be a simple wrapper for 
actual memory chuck.  For bytea, we haven't converted it to v8 object 
meaningfully, so probably it makes sense.  This will allow just store binary 
object in bytea column and users can write a iterative way to read the binary 
data in plv8 function.  It simply applies to _int, _short, _float etc, but 
since we've supported pg array -> js array conversion, this may introduce 
backward-incompatibility.

Original issue reported on code.google.com by [email protected] on 2 Dec 2012 at 11:05

CUSTOM_CC in make file is not used

What steps will reproduce the problem?
1. CUSTOM_CC = gcc


What is the expected output? What do you see instead?
I expect it not to use g++
But it seems g++ is hard-coded on line 36 of Makfile

g++ $(CCFLAGS) $(CPPFLAGS) -I $(V8DIR)/include -fPIC -c -o $@ $<


This should probably be changed to 
${CUSTOM_CC}  $(CCFLAGS) $(CPPFLAGS) -I $(V8DIR)/include -fPIC -c -o $@ $<

As noted in ticket #29, I had to switch to using gcc under mingw to force 
libstdc++ to be statically compiled.  So I had to make this additional change 
to force use of my CUSTOM_CC.



Original issue reported on code.google.com by [email protected] on 25 Jul 2012 at 1:51

ReferenceError: plv8 is not defined

What steps will reproduce the problem?
1. install the extension
2. run sql command:
   DO $$ plv8.elog(NOTICE, 'this', 'is', 'inline', 'code') $$ LANGUAGE plv8;

What is the expected output? What do you see instead?

Expected: some text
I get: 

ERROR:  ReferenceError: plv8 is not defined
DETAIL:  undefined() LINE 1:  plv8.elog(NOTICE, 'this', 'is', 'inline', 'code') 


********** Error **********

ERROR: ReferenceError: plv8 is not defined
SQL state: XX000

What version of the product are you using? On what operating system?
Postgresql 9.1.2
plv8 snapshot 2011-09-11  
v8 from svn

Original issue reported on code.google.com by [email protected] on 16 Apr 2012 at 3:50

Coffeescript support

Being able to write coffeescript syntax inside postgresql would be amazing.  
Not sure of the best way to make that happen.

Original issue reported on code.google.com by [email protected] on 10 Sep 2011 at 5:48

SRF returned records must match expected type

What steps will reproduce the problem?

 create or replace function xxx(n int) returns setof record language plv8 as 
    $x$ var i; for (i=0; i<n; i++) yield({n: i*2}); $x$;
 select * from xxx(3) as x(x int); 

What is the expected output? 

  empty records

What do you see instead?

  error.



Original issue reported on code.google.com by [email protected] on 30 Oct 2011 at 10:04

type coercion (string to int) fails

This might not be a bug, but I'm having a rough go with type coercion errors so 
hopefully this can be fixed.

summary: (id is type integer)

plv8.execute("select * from typetest where id = '1'") -- works
plv8.execute("select * from typetest where id = $1",['1']) -- Error: operator 
does not exist: integer = text


detail:

CREATE TABLE typetest (id serial, name text);
INSERT INTO typetest(name) values('test');
do $$ plv8.elog(NOTICE,JSON.stringify(plv8.execute("select * from typetest 
where id = '1'"))) $$ language plv8;
do $$ plv8.elog(NOTICE,JSON.stringify(plv8.execute("select * from typetest 
where id = $1",['1']))) $$ language plv8;
DROP TABLE typetest;

output:

psql:db/plv8bug.sql:1: NOTICE:  CREATE TABLE will create implicit sequence 
"typetest_id_seq" for serial column "typetest.id"
CREATE TABLE
INSERT 0 1
psql:db/plv8bug.sql:3: NOTICE:  [{"id":1,"name":"test"}]
DO
psql:db/plv8bug.sql:4: ERROR:  Error: operator does not exist: integer = text
DETAIL:  undefined() LINE 1:  
plv8.elog(NOTICE,JSON.stringify(plv8.execute("select * from typetest where id
DROP TABLE

using plv8 latest trunk, pg 9.1.3


Original issue reported on code.google.com by [email protected] on 16 May 2012 at 8:27

hstore parser

hstore value is returned as a string, a javascript object is obviously 
preferable.  I'm looking at writing a parser in js for now, but wondered if 
this could be handled by plv8 natively.

current output:

psql=# do language plv8 $$ plv8.elog(NOTICE,plv8.execute("SELECT 
'a=>1,b=>2'::hstore;")[0].hstore); $$;
NOTICE:  "a"=>"1", "b"=>"2"

desired output:

js obj: {a:"1", b:"2"}

Thanks

Original issue reported on code.google.com by [email protected] on 27 Jun 2012 at 7:14

invalid plcoffee code causes postgresql to segfault

create or replace function test1(i int) returns setof record as $$              
  return [{ i: true }]                                                          
$$ language plcoffee;                                                           

select test1(2);


Shows this in the logs:

LOG:  duration: 0.859 ms  statement: create or replace function test1(i int) 
returns setof record as $$
      return [{ i: true }]
    $$ language plcoffee;
LOG:  server process (PID 83707) was terminated by signal 11: Segmentation fault

Original issue reported on code.google.com by [email protected] on 10 May 2012 at 10:13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.