Skip to content

ext/pgsql: Update outdated PostgreSQL version requirements#5409

Open
KentarouTakeda wants to merge 1 commit intophp:masterfrom
KentarouTakeda:fix/pgsql-outdated-version-requirements
Open

ext/pgsql: Update outdated PostgreSQL version requirements#5409
KentarouTakeda wants to merge 1 commit intophp:masterfrom
KentarouTakeda:fix/pgsql-outdated-version-requirements

Conversation

@KentarouTakeda
Copy link
Contributor

Summary

The pgsql extension documentation references PostgreSQL versions that have been outdated for years. The requirements page (reference/pgsql/setup.xml) states:

https://www.php.net/manual/en/pgsql.requirements.php

To use PostgreSQL support, you need PostgreSQL 6.5 or later,
PostgreSQL 8.0 or later to enable all PostgreSQL module features.

However, the actual minimum libpq versions enforced by php-src are:

PHP version Minimum libpq Commit
PHP 8.0+ libpq 9.1 php/php-src@ce668c0ec6
PHP 8.4+ libpq 10.0 php/php-src#14628

The "PostgreSQL 6.5" requirement has been incorrect since at least PHP 8.0.0 (released 2020-11-26), which requires libpq 9.1 via PQlibVersion check in ext/pgsql/config.m4. As of PHP 8.4, the minimum was further raised to libpq 10.0 via PQencryptPasswordConn check in build/php.m4.

Changes

  • setup.xml: Update requirements to match php-src, following the same pattern used by ext/curl and ext/openssl (per-PHP-version listing).
  • 14 function pages: Remove notes referencing PostgreSQL versions 6.3–9.0 that are no longer relevant given the libpq 10.0 minimum. These include version-gated notes for pg_prepare, pg_query_params, pg_execute, pg_escape_string, pg_escape_identifier, pg_escape_literal, pg_client_encoding, pg_unescape_bytea, pg_result_error_field, pg_parameter_status, pg_lo_create, pg_version, pg_affected_rows, and the general reference.xml.

## Summary

The pgsql extension documentation references PostgreSQL versions that have been
outdated for years. The requirements page (`reference/pgsql/setup.xml`) states:

https://www.php.net/manual/en/pgsql.requirements.php

> To use PostgreSQL support, you need PostgreSQL 6.5 or later,
> PostgreSQL 8.0 or later to enable all PostgreSQL module features.

However, the actual minimum libpq versions enforced by php-src are:

| PHP version | Minimum libpq | Commit |
|---|---|---|
| PHP 8.0+ | libpq 9.1 | php/php-src@ce668c0ec6 |
| PHP 8.4+ | libpq 10.0 | php/php-src#14628 |

The "PostgreSQL 6.5" requirement has been incorrect since at least PHP 8.0.0
(released 2020-11-26), which requires libpq 9.1 via `PQlibVersion` check in
`ext/pgsql/config.m4`. As of PHP 8.4, the minimum was further raised to libpq
10.0 via `PQencryptPasswordConn` check in `build/php.m4`.

## Changes

- **setup.xml**: Update requirements to match php-src, following the same
  pattern used by ext/curl and ext/openssl (per-PHP-version listing).
- **14 function pages**: Remove notes referencing PostgreSQL versions 6.3–9.0
  that are no longer relevant given the libpq 10.0 minimum. These include
  version-gated notes for `pg_prepare`, `pg_query_params`, `pg_execute`,
  `pg_escape_string`, `pg_escape_identifier`, `pg_escape_literal`,
  `pg_client_encoding`, `pg_unescape_bytea`, `pg_result_error_field`,
  `pg_parameter_status`, `pg_lo_create`, `pg_version`, `pg_affected_rows`,
  and the general `reference.xml`.
KentarouTakeda added a commit to KentarouTakeda/php-src that referenced this pull request Mar 8, 2026
…ating libpq 10

While working on php/doc-en#5409 to clean up outdated PostgreSQL
version notes in the documentation, I noticed that the source code
also retains #ifdef guards for symbols guaranteed to exist in
libpq >= 10.0 (the minimum enforced in build/php.m4 via
PQencryptPasswordConn).

Removed guards (all confirmed in PostgreSQL 10 documentation):

- `PG_DIAG_{INTERNAL_POSITION,INTERNAL_QUERY}`: libpq 8.0+
- `PG_DIAG_{SCHEMA,TABLE,COLUMN,DATATYPE,CONSTRAINT}_NAME`: libpq 9.3+
- `PG_DIAG_SEVERITY_NONLOCALIZED`: libpq 9.6+
- `CONNECTION_SSL_STARTUP`: libpq 8.0+
- `CONNECTION_CONSUME`: libpq 10.0+

Refs:
- https://www.postgresql.org/docs/10/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD
- https://www.postgresql.org/docs/10/libpq-connect.html#LIBPQ-PQCONNECTSTARTPARAMS
- https://github.com/php/php-src/blob/53e31d58834ef04375dae7bdc549d73dae371c5a/build/php.m4#L1927
devnexen pushed a commit to php/php-src that referenced this pull request Mar 8, 2026
…ating libpq 10 (#21384)

While working on php/doc-en#5409 to clean up outdated PostgreSQL
version notes in the documentation, I noticed that the source code
also retains #ifdef guards for symbols guaranteed to exist in
libpq >= 10.0 (the minimum enforced in build/php.m4 via
PQencryptPasswordConn).

Removed guards (all confirmed in PostgreSQL 10 documentation):

- `PG_DIAG_{INTERNAL_POSITION,INTERNAL_QUERY}`: libpq 8.0+
- `PG_DIAG_{SCHEMA,TABLE,COLUMN,DATATYPE,CONSTRAINT}_NAME`: libpq 9.3+
- `PG_DIAG_SEVERITY_NONLOCALIZED`: libpq 9.6+
- `CONNECTION_SSL_STARTUP`: libpq 8.0+
- `CONNECTION_CONSUME`: libpq 10.0+

Refs:
- https://www.postgresql.org/docs/10/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD
- https://www.postgresql.org/docs/10/libpq-connect.html#LIBPQ-PQCONNECTSTARTPARAMS
- https://github.com/php/php-src/blob/53e31d58834ef04375dae7bdc549d73dae371c5a/build/php.m4#L1927
Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, content wise. cc @Girgias tough

@Girgias
Copy link
Member

Girgias commented Mar 9, 2026

What is the minimum libpq version for PHP 7? The documentation covers PHP 7.0 and above.

@KentarouTakeda
Copy link
Contributor Author

PHP 7.x had no explicit minimum libpq version — it used feature detection via AC_CHECK_LIB rather than version enforcement, so I documented only the explicit requirements introduced in PHP 8.0.

I also considered whether the per-function libpq version notes should be retained, but concluded they are unnecessary — the most recent one (pg_affected_rows, PostgreSQL 9.0) dates back to 2010, well below the minimum for any supported PHP version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants