3

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 'plv8'
VOLATILE
CALLED ON NULL INPUT
SECURITY DEFINER
COST 100;

Under postgres user everything works well:

DO $$ 
  plv8.elog(NOTICE, hello('John'));
$$ LANGUAGE plv8;

the result - John, hello! Then created user test and tryed to run the function:

ERROR: ReferenceError: hello is not defined
SQL-state: XX000

tryied to grant user test on execute plv8_startup - the result is the same. What is wrong?

user2627000
  • 317
  • 1
  • 2
  • 10

1 Answers1

1

It was my bug - function was created not in public schema, so system could not start it under the test user rights/

user2627000
  • 317
  • 1
  • 2
  • 10