Software 42309 Published by

pg_builder 2.1.0 has been released with support for Postgres 15 syntax. This is a query builder for Postgres with a twist: it contains a partial reimplementation of PostgreSQL's own query parser.



pg_builder 2.1.0 released with support for Postgres 15 syntax

I'm pleased to announce the release of  pg_builder PHP package updated for Postgres 15 syntax.
Gnome_shell_screenshot_0gm9u1

pg_builder 2.1.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 15 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.

Main changes in the new release

  • Allow parsing and building MERGE statements.
  • Reject numeric literals and positional parameters with trailing non-digits: previously SELECT 123abc was parsed as SELECT 123 AS abc, now it will throw an exception.

Full release notes

The package can be  downloaded from Github or installed with Composer:

$ composer require sad_spirit/pg_builder

pg_builder can be used on its own, using it together with  pg_wrapper allows to run the built queries with transparent conversion of query parameters to Postgres types.

pg_builder 2.1.0 released with support for Postgres 15 syntax