From: | Alexey Borzov via PostgreSQL Announce <announce-noreply(at)postgresql(dot)org> |
---|---|
To: | PostgreSQL Announce <pgsql-announce(at)lists(dot)postgresql(dot)org> |
Subject: | pg_builder and pg_wrapper 3.0 released with support for Postgres 17 syntax |
Date: | 2025-02-28 21:53:10 |
Message-ID: | 174077959048.682.7953057118817432854@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-announce |
I am pleased to announce the release of [pg_builder](https://github.com/sad-spirit/pg-builder) and [pg_wrapper](https://github.com/sad-spirit/pg-wrapper) packages for PHP updated for Postgres 17 syntax.
## pg_builder 3.0
pg_builder is a query builder for Postgres backed by a partial PHP reimplementation of PostgreSQL's own SQL parser. It supports almost all syntax available in Postgres 17 for `SELECT` (and `VALUES`), `INSERT`, `UPDATE`, `DELETE`, and `MERGE` queries.
With pg_builder it is possible to start with a manually written query, parse it into an Abstract Syntax Tree, add query parts (either as Node objects or as strings) to this tree or remove them, and finally convert the tree back to an SQL string.
Release highlights:
* Support for new syntax of Postgres 17
* `MERGE` statement improvements: `RETURNING` clause, `WHEN NOT MATCHED BY SOURCE` action, possible to use in `WITH`;
* New SQL/JSON constructs: `json()`, `json_scalar()`, `json_serialize()`, `json_exists()`, `json_query()`, `json_value()`, `json_table()`.
* Package manual rewritten and published on [pg-builder.readthedocs.io](https://pg-builder.readthedocs.io/)
* Now requires PHP 8.2+ and Postgres 12+, tested on PHP 8.4 and Postgres 17
[Full release notes](https://github.com/sad-spirit/pg-builder/blob/v3.0.0/Changelog.md)
The package can be [downloaded from GitHub](https://github.com/sad-spirit/pg-builder/releases/tag/v3.0.0) or installed with Composer:
$ composer require sad_spirit/pg_builder
## pg_wrapper 3.0
pg_wrapper provides converters for PostgreSQL data types and an object-oriented wrapper for PHP's native pgsql extension that uses these converters. Conversion of query result fields is done automatically using database metadata, query parameters may require specifying type.
For those types where a corresponding native PHP type or class is available it is used (`text` -> `string`, `timestamp` -> `DateTimeImmutable`, `hstore` -> associative array, etc.). For other types (geometric types, ranges) the package provides custom classes. If base types can be converted, then composite types, arrays, ranges using those can be handled as well.
Release highlights:
* New iterator methods for query results;
* It is possible to log executed queries using [PSR-3 logger](https://www.php-fig.org/psr/psr-3/);
* Converter between Postgres `ENUM` types and PHP's string-backed enums;
* Package manual rewritten and published on [pg-wrapper.readthedocs.io](https://pg-wrapper.readthedocs.io/);
* Now requires PHP 8.2+ and Postgres 12+, tested on PHP 8.4 and Postgres 17.
[Full release notes](https://github.com/sad-spirit/pg-wrapper/blob/v3.0.0/Changelog.md)
The package can be [downloaded from GitHub](https://github.com/sad-spirit/pg-wrapper/releases/tag/v3.0.0) or installed with composer
$ composer require sad_spirit/pg_wrapper
From | Date | Subject | |
---|---|---|---|
Next Message | The CloudNativePG Contributors via PostgreSQL Announce | 2025-02-28 21:55:03 | CloudNativePG 1.25.1 and 1.24.3 Released! |
Previous Message | PostgreSQLFr via PostgreSQL Announce | 2025-02-28 21:52:59 | PG Day France 2025: Announcement and CfS |