Search by

k-kinzal / sql-semantics-postgres

kinzal

PostgreSQL statement models, SQL reconstruction, and schema binding for SQL Semantics

Package info

github.com/k-kinzal/sql-semantics-postgres

Documentation

pkg:composer/k-kinzal/sql-semantics-postgres

Statistics

Installs: 0

Dependents: 1

Suggesters: 0

Stars: 0

dev-main 2026-09-28 02:33 UTC

This package is auto-updated.

Last update: 2026-09-28 02:33:38 UTC


README

Packagist Downloads PHP Version License: MIT Docs Ask DeepWiki

SQL Semantics for PostgreSQL adds PostgreSQL to SQL Semantics: the typed statement models of the official PostgreSQL grammars, the PostgreSQL rules for reading declarations, and the PostgreSQL builder that composes values under stable names. Installing it also installs the shared SQL Semantics runtime, and Dialect::PostgreSql selects PostgreSQL in the runtime's Semantics. No database connection is needed.

Requirements

  • PHP 8.1+ with the zlib extension

Support Syntax

The following grammar versions are supported. Pass the version tag as the second argument of Semantics; omitting it uses the default.

Version Version tag Default
16.6 pg-16.6
17.2 pg-17.2 Yes

Installation

composer require k-kinzal/sql-semantics-postgres

Usage

use SqlSemantics\Facade\Semantics;
use SqlSemantics\Platform\PostgreSql\Dialect;

$statement = (new Semantics(Dialect::PostgreSql))->analyze("INSERT INTO users (id, name) VALUES (1, 'Alice') RETURNING id");

$statement->toString(); // "INSERT INTO users ( id , name ) VALUES( 1 , 'Alice' ) RETURNING id"

See the SQL Semantics documentation for statement models, traversal, dependencies, and composition.

License

MIT License. See LICENSE for details.