k-kinzal / sql-semantics-postgres
PostgreSQL statement models, SQL reconstruction, and schema binding for SQL Semantics
Package info
github.com/k-kinzal/sql-semantics-postgres
pkg:composer/k-kinzal/sql-semantics-postgres
Requires
- php: ^8.1
- k-kinzal/sql-parser: dev-main
- k-kinzal/sql-semantics: dev-main
Requires (Dev)
- brianium/paratest: ^7.3
- deptrac/deptrac: ^3.0
- fakerphp/faker: ^1.23
- friendsofphp/php-cs-fixer: ^3.95.25
- k-kinzal/bison-parser: dev-main
- k-kinzal/php-ai-toolkit: dev-main
- k-kinzal/sql-faker: dev-main
- k-kinzal/sql-formatter: dev-main
- nikic/php-fuzzer: ^0.0.11
- phpbench/phpbench: ^1.4
- phpcompatibility/php-compatibility: ^10.0.0-alpha2
- phpstan/phpstan: ^2.1
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: ^4.0.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-28 02:33:38 UTC
README
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.