PL/Ruby 2.4.0
Feature parity with the sibling PL/php 2.4.
Added
plruby.on_init: a Ruby source snippet evaluated at the top level when the interpreter is first initialized in a session, beforeplruby_modulesandplruby.start_proc. The counterpart ofplperl.on_init.anycompatibleandanycompatiblearrayaccepted as argument and return types on PostgreSQL 13 and newer.- Error
CONTEXTlines: an error raised while PL/Ruby code runs now carries aCONTEXT: PL/Ruby function "name"line (orPL/Ruby anonymous code blockfor aDOblock), like every other procedural language.
Changed
- Polymorphic array arguments arrive as Ruby
Arrays. Ananyarray(oranycompatiblearray) argument is resolved to its concrete type at call time and converts to a RubyArrayinstead of arriving as text;anyelementarguments likewise arrive as their native Ruby type.
Fixed
- Hardened the compiled-function cache: a failed recompile no longer leaves a freed descriptor pointer in the cache (a latent use-after-free).
All changes are in the shared library; ALTER EXTENSION plruby UPDATE TO '2.4' completes the upgrade after installing the new binary. Verified on PostgreSQL 12/16/18 with the jsonb_plruby and hstore_plruby transforms.