Skip to content

Enable SQLite column metadata#1204

Merged
crazywhalecc merged 1 commit into
crazywhalecc:mainfrom
JanJakes:fix/sqlite-column-metadata
Jul 7, 2026
Merged

Enable SQLite column metadata#1204
crazywhalecc merged 1 commit into
crazywhalecc:mainfrom
JanJakes:fix/sqlite-column-metadata

Conversation

@JanJakes

@JanJakes JanJakes commented Jul 7, 2026

Copy link
Copy Markdown

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.

@crazywhalecc crazywhalecc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

v3 branch should do this too.

@JanJakes

JanJakes commented Jul 7, 2026

Copy link
Copy Markdown
Author

v3 branch should do this too.

@crazywhalecc Should I open another PR against v3, or would that be cherry-picked from main?

@crazywhalecc

crazywhalecc commented Jul 7, 2026

Copy link
Copy Markdown
Owner

v3 branch should do this too.

@crazywhalecc Should I open another PR against v3, or would that be cherry-picked from main?

Ah v3 is totally refactored version. You need to do similar changes on v3 branch and open another PR.

@JanJakes

JanJakes commented Jul 7, 2026

Copy link
Copy Markdown
Author

@crazywhalecc I gave it a shot in #1205.

@crazywhalecc crazywhalecc merged commit 5329723 into crazywhalecc:main Jul 7, 2026
6 checks passed
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