Problem/Motivation

## Problem/Motivation

The module currently depends on PHP's procedural
PostgreSQL extension (`ext-pgsql`) and uses `pg_*`
functions such as `pg_connect()`, `pg_query()`,
`pg_query_params()`, `pg_escape_literal()`, and
`pg_escape_identifier()`.

This blocks deployments where Drupal/PHP has PDO
PostgreSQL support through `pdo_pgsql`, but the
procedural `pgsql` extension is not installed on the
webserver.

In those environments, connecting to PostgreSQL through
PDO is possible, but this module still cannot be
installed or used because of the hard `ext-pgsql`
dependency and runtime use of `pg_*`.

This issue is narrower than #3547615, which tracks a
broader refactor toward Drupal's database APIs.

Proposed resolution

Replace the direct procedural PostgreSQL extension
usage with PDO-based equivalents:

- Use `\PDO` for the PostgreSQL connection.
- Replace `pg_query()` / `pg_query_params()` with PDO
`exec()`, `query()`, and prepared statements.
- Replace `pg_escape_literal()` with PDO `quote()`.
- Replace `pg_escape_identifier()` with local
PostgreSQL identifier quoting.
- Update Composer requirements from `ext-pgsql` to
`ext-pdo` and `ext-pdo_pgsql`.
- Update README requirements to mention `pdo_pgsql`.

This keeps the current provider architecture and
pgvector-specific SQL intact. It only removes the hard
dependency on the procedural `pgsql` extension.

- #3547615: Use the Drupal core pgsql module to do most
of the database interactions
- #3562422: Add option to use Drupal’s default database
connection in Postgres provider

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

emielb created an issue.