Skip to content

PL/Ruby 2.4.0

Choose a tag to compare

@jdatcmd jdatcmd released this 06 Jul 14:07

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, before plruby_modules and plruby.start_proc. The counterpart of plperl.on_init.
  • anycompatible and anycompatiblearray accepted as argument and return types on PostgreSQL 13 and newer.
  • Error CONTEXT lines: an error raised while PL/Ruby code runs now carries a CONTEXT: PL/Ruby function "name" line (or PL/Ruby anonymous code block for a DO block), like every other procedural language.

Changed

  • Polymorphic array arguments arrive as Ruby Arrays. An anyarray (or anycompatiblearray) argument is resolved to its concrete type at call time and converts to a Ruby Array instead of arriving as text; anyelement arguments 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.