kokizzu / plv8js

Automatically exported from code.google.com/p/plv8js
Other
0 stars 0 forks source link

"REPLACE" doesn't work #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 umi.tan...@gmail.com on 28 Aug 2010 at 5:44

GoogleCodeExporter commented 9 years ago
It was a bug, and fixed in rev. 75119bef75.
A regression test is also added.

Not that we need not only v8::Persist<T>::Dispose()
but also Clear() to set the handle to be IsEmpty().

Original comment by itagaki....@gmail.com on 28 Aug 2010 at 1:19