pltoolbox
pltoolbox · provide C utility functions for PostgreSQL stored procedures
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100699 | pltoolbox | pltoolbox | 1.0.3 | FUNC | BSD-2-Clause | C |
Usage
Sources:
pltoolbox is a collection of C utility functions intended for PostgreSQL stored procedures. Version 1.0.3 creates the non-relocatable pst schema and groups formatting, string, date, record, diff, and bitmap-set helpers there.
Core Workflow
Install the extension, then schema-qualify its functions to avoid ambiguity with PostgreSQL built-ins.
pst.format and pst.sprintf implement percent-style formatting. pst.concat, pst.concat_ws, pst.concat_js, and pst.concat_sql assemble values with different quoting rules.
Object Index
- String helpers:
pst.reverse,pst.left,pst.right, andpst.chars_to_array. - Date helpers:
pst.next_dayandpst.last_day. - Diff helpers:
pst.diff_stringandpst.lc_substring. - Record helpers:
pst.record_expand,pst.record_get_field,pst.record_get_fields, andpst.record_set_fields. - Bitmap helpers: the
pst.bitmapsettype, membership and set-operation functions, integer-array casts,pst.bitmapset_collect, and union operator||. - Formatting operator:
%%is installed in bothpublicandpst.
Compatibility and Maintenance
The upstream README says that its documentation remains incomplete and that some functions later appeared in PostgreSQL core with behavior that is not fully equal. In particular, the project’s left and right semantics changed historically for negative lengths. Always schema-qualify calls when the same name exists in core, and test the edge cases used by application code.
This extension is not a general procedural language despite its name. The catalog marks it abandoned, and its C implementation depends on PostgreSQL internals such as bitmap sets and tuple layouts. Pin a tested server build; do not assume binary or behavioral compatibility across major PostgreSQL releases.