Skip to content

PostgreSQL compatibility: Quote column names in WHERE clauses #573

@wazum

Description

@wazum

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;'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions