Skip to content

Endpoints SQL translator emits BigQuery backticks on PostgreSQL backend (OSS v1.36.1 through v1.42.0) #3554

Description

@dainjaruss

Bug

Logflare OSS v1.36.1 (and verified byte-identical through v1.42.0) — the /endpoints page's SQL translator rewrites friendly source-name references into BigQuery-style backtick-quoted identifiers regardless of backend. When the backend is PostgreSQL, the resulting query errors with %Postgrex.Error{... message: "syntax error at or near \"""...}`.

Code path

Logflare.Endpoints.Query.infer_language_from_backend/1 returns :pg_sql only when a Postgres backend is explicitly selected on the endpoint AND Supabase mode is OFF. Endpoint defaults to :bq_sql regardless of deployment mode.

Workaround

Stick with /query page (doesn't run the broken translator) and save URL as a browser bookmark.

Attempted fix that regresses worse

Setting LOGFLARE_FEATURE_FLAG_OVERRIDE=multibackend=true,endpointbackendselection=true is supposed to surface a Backend selector. In v1.36.1 the toggle removes the query SQL field entirely from the endpoint create form.

Suggested upstream change

The endpoint create form should default language: :pg_sql when the deployment is single-tenant PG, not require explicit per-endpoint backend selection that's gated behind a buggy flag.

Evidence / full diagnostic

Full diagnostic + code-path analysis in the Paari project's runbook:
https://github.com/dainjaruss/paari/blob/main/docs/runbooks/logflare.md#the-endpoints-pg-translator-bug-logflare-oss-bug-upstream-unfixed-as-of-v1420

(Quote of the section at time of filing is included below for permanence.)


The /endpoints PG-translator bug (Logflare OSS bug, upstream unfixed as of v1.42.0)

The Endpoints UI runs a pre-execution SQL translator that rewrites friendly source-name references into BigQuery-style backtick-quoted internal identifiers regardless of the configured backend. When the backend is PostgreSQL, the resulting query errors:

%Postgrex.Error{... message: "syntax error at or near \"`\"" ...}
... query: "... FROM `.1_default.5bf225a1_037e_4092_8899_c7515e503bce` ..."

The translator emits BQ backticks because the endpoint defaults to language: :bq_sql. Code path: Logflare.Endpoints.Query.infer_language_from_backend/1 returns :pg_sql only when a Postgres backend is explicitly selected on the endpoint AND Supabase mode is OFF.

Workaround on v1.36.1: stick with the /query page and save the URL as a browser bookmark. The /query page does NOT run the broken translator. You lose HTTP-callable named endpoints but gain working queries.

Attempted fix that regresses worse: setting LOGFLARE_FEATURE_FLAG_OVERRIDE=multibackend=true,endpointbackendselection=true is supposed to surface a Backend selector in the endpoint create form. In practice on v1.36.1 the toggle removes the query SQL field entirely from the form (form layout regression). Revert with LOGFLARE_FEATURE_FLAG_OVERRIDE=multibackend=true (single flag) and recreate the logflare container. Browser hard-refresh required afterward.

Code-side analysis (from a v1.36.1→v1.42.0 changelog audit on 2026-05-26): the PG translator code path is byte-identical between v1.36.1 and v1.42.0. No upstream release fixes this. Upstream issue to file: the endpoint create form should default language: :pg_sql when the deployment is single-tenant PG, not require explicit per-endpoint backend selection that's gated behind a broken flag.


This was filed from Paari (private family photo app) which runs self-hosted single-tenant OSS Logflare on Postgres. See related Paari issue: https://github.com/dainjaruss/paari/issues/980

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