pg_builder and pg_wrapper 2.3.0 released with support for Postgres 16 syntax

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 2.3.0 released with support for Postgres 16 syntax
Date: 2023-09-21 10:33:05
Message-ID: 169529238537.3727336.3302132102127502223@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce

I'm 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) PHP packages updated for Postgres 16 syntax as well as the initial release of [pg_gateway](https://github.com/sad-spirit/pg-gateway).

## pg_builder 2.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 16 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.

The new release adds support for features added in PostgreSQL 16:

* SQL/JSON functions and expressions: `IS JSON` predicate, aggregate functions `json_arrayagg()` and `json_objectagg()`, constructor functions `json_array()` and `json_object()`.
* Non-decimal integer literals and underscores as separators in numeric literals.
* Optional aliases for subqueries in `FROM`, added `SYSTEM_USER` server variable, `[NO] INDENT` option for `XMLSERIALIZE()` expression.

[Full release notes](https://github.com/sad-spirit/pg-builder/blob/v2.3.0/Changelog.md)

The package can be [downloaded from Github](https://github.com/sad-spirit/pg-builder/releases/tag/v2.3.0) or installed with Composer:

```
$ composer require sad_spirit/pg_builder
```
## pg_wrapper 2.3.0

pg_wrapper provides converters for PostgreSQL data types and an OO wrapper around 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.

The new release adds support for features added in PostgreSQL 16:

* When connected to Postgres 16+, numeric type converters will accept non-decimal integer literals
and numeric literals with underscores for digit separators, allowing to use those as query parameter values.

[Full release notes](https://github.com/sad-spirit/pg-wrapper/blob/v2.3.0/Changelog.md)

The package can be [downloaded from Github](https://github.com/sad-spirit/pg-wrapper/releases/tag/v2.3.0) or installed with Composer:

```
$ composer require sad_spirit/pg_wrapper
```

## pg_gateway 0.1.0

This is a [Table Data Gateway](https://martinfowler.com/eaaCatalog/tableDataGateway.html) implementation built upon pg_wrapper and pg_builder packages. It adds the following features

* Gateways are aware of the table metadata and contain helper methods to create common conditions and the like,
* There are means to cache the complete query to skip parse/build cycle,
* It is possible to create a query via one gateway and join it to the query built by another.

As usual, the package can be [downloaded from Github](https://github.com/sad-spirit/pg-gateway/releases/tag/v0.1.0) or installed with Composer:

```
$ composer require sad_spirit/pg_gateway
```

Browse pgsql-announce by date

  From Date Subject
Next Message PoWA via PostgreSQL Announce 2023-09-21 10:34:07 powa-archivist 4.2.0 is out!
Previous Message Gilles Darold via PostgreSQL Announce 2023-09-18 14:35:02 pgtt v3.0 has been released