Skip to content

[v3] Enable SQLite column metadata#1205

Open
JanJakes wants to merge 2 commits into
crazywhalecc:v3from
JanJakes:fix/v3-sqlite-column-metadata
Open

[v3] Enable SQLite column metadata#1205
JanJakes wants to merge 2 commits into
crazywhalecc:v3from
JanJakes:fix/v3-sqlite-column-metadata

Conversation

@JanJakes

@JanJakes JanJakes commented Jul 7, 2026

Copy link
Copy Markdown

This is the v3 version of #1204. The v3 branch has a refactored package layout, so the same SQLite metadata fix is applied to the v3 package classes.

What Changed

  • Enable SQLITE_ENABLE_COLUMN_METADATA for Unix SQLite builds so macOS/Linux match the existing Windows SQLite Makefile.
  • Remove the pdo_sqlite configure override that forced sqlite3_column_table_name=no.
  • Add sanity checks for both the SQLite compile option and PDO column table metadata.

Why

SQLITE_ENABLE_COLUMN_METADATA is optional in SQLite, but it is used in almost every libsqlite distribution on Linux, macOS, and Windows. When PHP bundled SQLite itself, it used the flag too, and PHP's own test suite covers that flag.

When the flag is missing, SQLite does not expose sqlite3_column_table_name() and PDO then cannot populate PDOStatement::getColumnMeta()['table'], which breaks consumers who rely on this metadata.

Evidence

  • Platform builds broadly enable column metadata. Roger Binns found COLUMN_METADATA enabled on macOS, Debian, Fedora, Gentoo, Arch, Termux, FreeBSD, OpenBSD, Homebrew, MacPorts, Nix, Haikuports, and msys2.
  • Additional builds follow the same pattern. I checked Ubuntu, Alpine, RHEL-family distros, Amazon Linux, openSUSE, and official PHP Docker images, including Alpine variants.
  • PHP expects this path to work. PHP's pdo_sqlite configure script probes sqlite3_column_table_name() and defines HAVE_SQLITE3_COLUMN_TABLE_NAME; PHP's own PDO SQLite test suite covers that flag.
  • Static PHP CLI already enables it on Windows. This PR makes macOS/Linux match the Windows behavior.

References

Build Unix SQLite with SQLITE_ENABLE_COLUMN_METADATA so the metadata APIs are available on macOS and Linux.

Remove the pdo_sqlite configure override that forced PHP to treat sqlite3_column_table_name() as unavailable, and add sanity checks for both SQLite compile options and PDO column metadata.
@JanJakes JanJakes changed the title Enable SQLite column metadata Enable SQLite column metadata [v3] Jul 7, 2026
@JanJakes JanJakes changed the title Enable SQLite column metadata [v3] [v3] Enable SQLite column metadata Jul 7, 2026
@crazywhalecc crazywhalecc added the need-test This PR has not been tested yet, cannot merge now label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

StaticPHP Test Bot

Detected: Extensions: pdo_sqlite | Libraries: sqlite | Targets: none
Active labels: none
Available labels: need-test (gate), test/linux test/windows test/macos (platform), test/tier2 (extra arch), test/php-83 test/php-84 (PHP version)
Config: Linux x86_64 + Windows x86_64 + macOS arm64 | PHP 8.5 NTS

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

Labels

need-test This PR has not been tested yet, cannot merge now

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants