xhgui icon indicating copy to clipboard operation
xhgui copied to clipboard

PostgreSQL compatibility: Quote column names in WHERE clauses

Open wazum opened this issue 3 months ago • 0 comments

Problem

xhgui fails with PostgreSQL databases when filtering or viewing traces, showing:

  SQLSTATE[42703]: Undefined column: column "server" does not exist

PostgreSQL treats unquoted identifiers as lowercase, but xhgui's schema uses mixed-case column names (SERVER, simple_url, request_ts, etc.).

Solution

Quote all column names in WHERE clauses to preserve their exact case, making the queries work correctly with PostgreSQL while maintaining MySQL compatibility.

This is compatible and non-breaking for MySQL/MariaDB, as xhgui is already setting ANSI_QUOTES in src/ServiceProvider/PdoStorageProvider.php:

'SET SQL_MODE=ANSI_QUOTES;'

wazum avatar Sep 17 '25 04:09 wazum