# Upstream attribution

Derived from DbGate v7.3.0, commit `50e85345005aaae351db5a6cef5b0a2596efb9d1`.
Source: https://github.com/dbgate/dbgate/tree/v7.3.0/plugins/dbgate-plugin-postgres
Copyright: original DbGate contributors, including Jan Prochazka.
License: GPL-3.0; see LICENSE. The source required to rebuild this derivative is included.

The `src/upstream` directory preserves the official PostgreSQL driver. Local changes:

- New package/engine identity, translated driver title, export PostgreSQL only.
- Declare `columns` in stream callbacks; include engine in empty result headers.
- Enforce certificate validation for AWS IAM, before token acquisition; IAM uses host fields rather than a connection URL that can override TLS/password settings.
- Map native error positions to the original SQL and report export errors through stream destruction instead of silent EOF.

`src/autoquote` and `src/backend.js` implement the added quoting behavior. Build bundles the JavaScript runtime dependencies and ships a separate parser worker. Host tools use DBGate's existing `DBGATE_PACKAGES` contract. No DbGate application code is replaced.

The parser uses libpg-query 17.7.4, a MIT-licensed WebAssembly wrapper around
libpg_query 17-6.1.0 and the PostgreSQL 17 grammar. Its pinned package and WASM
asset are included in the build; installation requires no compiler or install
scripts. Source: https://github.com/constructive-io/libpg-query-node and
https://github.com/pganalyze/libpg_query/tree/17-6.1.0. Copyright notices for
the wrapper, libpg_query and PostgreSQL are in THIRD_PARTY_NOTICES.txt.
