PL/Ruby 2.2.0
Native jsonb, modern Ruby, and CI. Verified on PostgreSQL 11 through 18; every push is now checked by GitHub Actions on PostgreSQL 12–18 with Ruby 3.2, 3.3, and 3.4.
All plruby changes are in the shared library — after installing the new binary, ALTER EXTENSION plruby UPDATE completes the upgrade.
Added
jsonb_plruby— a companion extension providingTRANSFORM FOR TYPE jsonb: opted-in functions receive jsonb arguments as native Ruby data (Hash/Array/String/Integer/Float/booleans/nil) and return Ruby data into jsonb directly. Integers beyondFloatprecision andBigDecimalvalues serialize exactly. Build it from thejsonb_plruby/subdirectory, thenCREATE EXTENSION jsonb_plruby CASCADE.- Structured
pg_raise—pg_raise(level, message, detail:, hint:, sqlstate:)maps onto theereportfields (like PL/pgSQL'sRAISE ... USING); a PL/Ruby caller that rescues the error reads them back viaPLRuby::Error#detail/#hint/#sqlstate. PLRuby::Error#detail/#hint— caught database errors carry theirDETAILandHINTalongside the SQLSTATE.- Streaming
spi_query_prepared— executes a prepared plan through a cursor (block andPLRuby::Cursorforms) instead of materializing; the plan stays reusable after the cursor closes. - CI (GitHub Actions) — PostgreSQL 12–18 × system Ruby, plus Ruby 3.3/3.4, building both extensions and running both regression suites on every push and pull request.
- Ruby 3.3 / 3.4 support, including alternate expected files for their changed diagnostics.
- Regression suite grown to 37 tests plus the
jsonb_plrubysuite; new coverage for mid-sessionCREATE OR REPLACErecompilation.
Changed
- RubyGems is enabled in the embedded interpreter (was
--disable-gems): Ruby 3.4 shipscsv,bigdecimal, andbase64as bundled gems that plainrequirecannot see without it — and gems installed alongside the server's Ruby become requirable.did_you_mean/error_highlightstay disabled so error messages are deterministic. - Domain arguments arrive as the base type's Ruby value (a domain over
intis anInteger, overint[]anArray); previously they arrived as the text-form String. - Validation errors report the first line of the Ruby syntax error (Ruby 3.4's parser otherwise quotes the generated wrapper source over many lines).
Notes
- PL/Ruby remains untrusted and superuser-only by design.
- Full details in the CHANGELOG, language reference, and cookbook.