Skip to content

Commit 662c9f1

Browse files
jdatcmdclaude
andcommitted
Release 2.5.0: $_SD, bytea binary, SPI colmeta, ltree transform
PL/Python parity release. Bumps default_version to 2.5 with the standard no-op version move (all core 2.5 changes are in the shared library): - $_SD per-function static storage (PL/Python SD; $_SHARED is GD) - bytea <-> binary String mapping (PL/Python bytes; breaking) - spi_colnames/spi_coltypes/spi_coltypmods result metadata - the ltree_plruby transform ships as a separate extension Adds plruby--2.5.sql (copy of 2.4; SQL objects unchanged) and the no-op plruby--2.4--2.5.sql upgrade script; dates the CHANGELOG; test badge 42 -> 44. Verified on PG 18: full suite (44 tests) green, all three transform suites green, and the CREATE EXTENSION '2.0' -> ALTER EXTENSION UPDATE chain lands on 2.5. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0bcd4f1 commit 662c9f1

6 files changed

Lines changed: 55 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ All notable changes to PL/Ruby are documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and the project aims to follow [Semantic Versioning](https://semver.org/).
77

8-
## [Unreleased]
8+
## [2.5.0] - 2026-07-06
9+
10+
PL/Python parity: per-function `$_SD` storage, a raw-binary `bytea` mapping, SPI
11+
result column metadata, and an `ltree` transform. With these, PL/Ruby is at or
12+
ahead of PL/Python across the board. The core changes are in the shared library;
13+
`ALTER EXTENSION plruby UPDATE` completes the upgrade after installing the new
14+
binary. The `ltree` transform ships as the separate `ltree_plruby` extension.
915

1016
### Added
1117

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ MODULE_big = plruby
1717
OBJS = plruby.o plruby_io.o plruby_spi.o
1818

1919
EXTENSION = plruby
20-
DATA = plruby--2.0.sql plruby--2.1.sql plruby--2.2.sql plruby--2.3.sql plruby--2.4.sql plruby--2.0--2.1.sql plruby--2.1--2.2.sql plruby--2.2--2.3.sql plruby--2.3--2.4.sql
20+
DATA = plruby--2.0.sql plruby--2.1.sql plruby--2.2.sql plruby--2.3.sql plruby--2.4.sql plruby--2.5.sql plruby--2.0--2.1.sql plruby--2.1--2.2.sql plruby--2.2--2.3.sql plruby--2.3--2.4.sql plruby--2.4--2.5.sql
2121

2222
# Ruby compile/link flags, discovered via RbConfig.
2323
RUBY ?= ruby

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![CI](https://github.com/commandprompt/plruby/actions/workflows/ci.yml/badge.svg)](https://github.com/commandprompt/plruby/actions/workflows/ci.yml)
99
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-11_to_18-336791?logo=postgresql&logoColor=white)](https://www.postgresql.org/)
1010
[![Ruby](https://img.shields.io/badge/Ruby-3.x-CC342D?logo=ruby&logoColor=white)](https://www.ruby-lang.org/)
11-
[![Tests](https://img.shields.io/badge/tests-42_passing-brightgreen)](sql/)
11+
[![Tests](https://img.shields.io/badge/tests-44_passing-brightgreen)](sql/)
1212
[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
1313

1414
</div>
@@ -45,11 +45,11 @@ SELECT hello('world'); -- Hello, world!
4545
| 🔁 **Set-returning functions** | `RETURNS SETOF` / `RETURNS TABLE` with `return_next`. |
4646
| ⚡ **Triggers** | Row & statement triggers via `$_TD` (with `'SKIP'` / `'MODIFY'`). |
4747
| 📣 **Event triggers** | Back `CREATE EVENT TRIGGER` with `RETURNS event_trigger`. |
48-
| 🗄️ **Database access (SPI)** | `spi_exec`, `spi_fetch_row`, `spi_processed`, `spi_status`, `spi_rewind`. |
48+
| 🗄️ **Database access (SPI)** | `spi_exec`, `spi_fetch_row`, `spi_processed`, `spi_status`, `spi_rewind`, and result column metadata (`spi_colnames` / `spi_coltypes` / `spi_coltypmods`). |
4949
| 🌊 **Cursor streaming** | `spi_query` (block or handle), `spi_fetchrow`, `spi_cursor_close`, `Cursor#each`. Consume large results without materializing them. |
5050
| 📝 **Prepared statements** | `spi_prepare` / `spi_exec_prepared` / `spi_query_prepared` / `spi_freeplan`. |
5151
| 🔐 **Transaction control** | `spi_commit` / `spi_rollback` in procedures, plus `subtransaction` blocks. |
52-
| 🧰 **Utilities** | `quote_literal` / `quote_nullable` / `quote_ident`, `elog`, `$_SHARED`. |
52+
| 🧰 **Utilities** | `quote_literal` / `quote_nullable` / `quote_ident`, `elog`, session-shared `$_SHARED`, and per-function `$_SD`. |
5353
| 📦 **Session setup** | Anonymous `DO` blocks, `plruby_modules` autoloading, and a `plruby.start_proc` hook. |
5454
| 🔄 **Transforms** | `jsonb_plruby`, `hstore_plruby`, and `ltree_plruby`: functions declared `TRANSFORM FOR TYPE` exchange native Ruby Hashes/Arrays with `jsonb`, `hstore`, and `ltree`. |
5555

‎plruby--2.4--2.5.sql‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* Upgrade PL/Ruby from 2.4 to 2.5.
2+
*
3+
* Every 2.5 change lives in the shared library ($_SD per-function storage, the
4+
* bytea<->binary String mapping, and the spi_colnames/spi_coltypes/
5+
* spi_coltypmods result accessors); the ltree transform is a separate
6+
* extension (ltree_plruby). The core extension's SQL-level objects are
7+
* unchanged, so this script has nothing to do beyond moving the version.
8+
*/
9+
10+
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
11+
\echo Use "ALTER EXTENSION plruby UPDATE TO '2.5'" to load this file. \quit

‎plruby--2.5.sql‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* PL/Ruby language, packaged as an extension.
2+
*
3+
* The language is UNTRUSTED (created without the TRUSTED attribute): on modern
4+
* Ruby there is no sandbox ($SAFE was removed in Ruby 3.0), so PL/Ruby
5+
* functions can do anything the server's OS user can. Creating them is
6+
* therefore restricted to superusers.
7+
*/
8+
9+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
10+
\echo Use "CREATE EXTENSION plruby" to load this file. \quit
11+
12+
CREATE FUNCTION plruby_call_handler()
13+
RETURNS language_handler
14+
AS 'MODULE_PATHNAME'
15+
LANGUAGE C;
16+
17+
CREATE FUNCTION plruby_inline_handler(internal)
18+
RETURNS void
19+
AS 'MODULE_PATHNAME'
20+
LANGUAGE C;
21+
22+
CREATE FUNCTION plruby_validator(oid)
23+
RETURNS void
24+
AS 'MODULE_PATHNAME'
25+
LANGUAGE C;
26+
27+
CREATE LANGUAGE plruby
28+
HANDLER plruby_call_handler
29+
INLINE plruby_inline_handler
30+
VALIDATOR plruby_validator;
31+
32+
COMMENT ON LANGUAGE plruby IS 'PL/Ruby procedural language (untrusted)';

‎plruby.control‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
# superuser-only to install and the language is created without the TRUSTED
77
# attribute.
88
comment = 'PL/Ruby procedural language (untrusted)'
9-
default_version = '2.4'
9+
default_version = '2.5'
1010
module_pathname = '$libdir/plruby'
1111
relocatable = false

0 commit comments

Comments
 (0)