clkao / plv8js-migrated

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

inout parameter not working #81

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
CREATE OR REPLACE FUNCTION util.json_test(INOUT p_test integer)
  RETURNS integer AS
$BODY$
    p_test = 2;
    return p_test;
$BODY$
  LANGUAGE plv8 VOLATILE
  COST 1;

DO $$
declare
 test1 integer = 1;
 test2 integer;
begin
    select util.json_test(test1) into test2;
    Raise ' test1:%,  test2:% ', test1, test2;
end;
$$

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

since i assign 2 to test1 inside the function i would expect it to be 2 in the 
calling envirement after calling the function.

output instead is:

ERROR:  test1:1,  test2:2 
SQL Status:P0001

What version of the product are you using? On what operating system?
i am using the version bundled with heroku postgresapp 9.3 for mac osx. 

Original issue reported on code.google.com by alexande...@me.com on 2 Oct 2013 at 6:45

GoogleCodeExporter commented 9 years ago
I don't think your expecting behavior is the one defined as Postgres INOUT 
parameter.  Can you try plpgsql instead of plv8?  I bet test1 is 1 and test2 is 
2 again.

Original comment by umi.tan...@gmail.com on 6 Oct 2013 at 7:04

GoogleCodeExporter commented 9 years ago

Original comment by umi.tan...@gmail.com on 21 Oct 2013 at 12:20