3

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 plugin_debugger works only with plpgSQL. Is there anybody outside who found a nice way to do PLV8 debugging in another way then using masses of annoying plv8.elog(NOTICE, 'this happens with my variable')? Maybe any third party tool or secret plugin?

1 Answer 1

3

Remote debugging is no longer supported in pl/v8.

It was available in pl/v8 up to version 1.4.x (see #131). Notable missing features in older releases include ES6.

Workarounds

If you need to debug ES6/7 code using pl/v8 1.4.x you could transpile it using Traceur.


From the documentation for 1.4.x:

PL/v8 supports v8 remote debugger. You need to enable it at the compile time to pass ENABLE_DEBUGGER_SUPPORT to make. make static will automatically turns it on. If enabled, and once PL/v8 module is loaded (and the execution engine is initialized, PL/v8 accepts a remote debugger connection. If you have d8 from v8 package, run with --remote-debug --debug-port=35432 to attach the functions. If you want to change the remote debugger port, there is a GUC plv8.debugger_port to set the port number. You can also try debugger statement inside functions to set a breakpoint. For more details of v8 remote debugger, see v8 documentation.

If you're not familiar with debugging JavaScript (or v8) that might be a bit much to handle.

If you're interested in the low-level features of the debugging protocol, check this out.

To step through code might be some leg work, but here is a starting point for how that would be done.

If you were looking for a complete off-the-shelf solution or step-by-step tutorial I'm not sure that there is one specific to PL/v8.

I haven't personally tried any of these to debug PL/v8, however, it's possible one may connect and more or less work as expected: https://developer.chrome.com/devtools/docs/debugging-clients

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.