Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(hogql): upgrade SQL parser to v1.0.4 (#102890)

Paweł Szczurd3e23c73d642
diff --git a/docs/internal/hogql-language-service.md b/docs/internal/hogql-language-service.md
index cd0969cabea1..e67cbe1dfb1f 100644
--- a/docs/internal/hogql-language-service.md
+++ b/docs/internal/hogql-language-service.md
@@ -110,6 +110,11 @@ Aliases of the same relation share a cached field index and one candidate entry
Completion returns HTTP 400 when either limit is exceeded; validation returns a `query_limit` diagnostic.
Derived qualified suggestions are sorted and deduplicated before pagination.
+An unfinished block comment returns a parser error instead of blocking completion or validation.
+For example, `WITH recent AS (SELECT uuid FROM events) SELECT recent.uuid FROM recent WHERE /* unfinished` produces a `syntax_error` validation diagnostic.
+Completion before that comment returns a `parseError` without recovering CTE field suggestions; completion inside the comment remains disabled.
+Closed block comments and line comments at end of input remain valid.
+
### Recovery and remaining work
- Source-specific case-insensitive relation lookup remains unsupported. Python catalog nodes can opt in, for example for Snowflake, but the Go catalog payload does not carry that per-node flag. Supporting it requires publishing the metadata and implementing exact-match-first, opt-in fallback without merging distinct names. The service requires exact relation names until then; autocomplete prefix matching remains case-insensitive.
diff --git a/services/hogql-language-service/go.mod b/services/hogql-language-service/go.mod
index f0d1c212c6e3..c0158fa40bcc 100644
--- a/services/hogql-language-service/go.mod
+++ b/services/hogql-language-service/go.mod
@@ -2,4 +2,4 @@ module github.com/PostHog/posthog/services/hogql-language-service
go 1.27.1
-require github.com/orian/clickhouse-sql-parser v0.0.0-20260813141301-768a69c3d95a
+require github.com/orian/clickhouse-sql-parser v1.0.4
diff --git a/services/hogql-language-service/go.sum b/services/hogql-language-service/go.sum
index 3572070010ce..5481d995f0e5 100644
--- a/services/hogql-language-service/go.sum
+++ b/services/hogql-language-service/go.sum
@@ -1,7 +1,7 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/orian/clickhouse-sql-parser v0.0.0-20260813141301-768a69c3d95a h1:pEpE55SB1MrdR7O8Vow1zDmUeAJxKQ1PeRVNyXS5L4g=
-github.com/orian/clickhouse-sql-parser v0.0.0-20260813141301-768a69c3d95a/go.mod h1:22D/qoWV/Ipbn5Gcub+0ttta1wgzSDaJMprQRZWghoE=
+github.com/orian/clickhouse-sql-parser v1.0.4 h1:/DKpB9h4Ucw1ZEdERDaR/UceYF78MmEBparYV2UG4ao=
+github.com/orian/clickhouse-sql-parser v1.0.4/go.mod h1:22D/qoWV/Ipbn5Gcub+0ttta1wgzSDaJMprQRZWghoE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sebdah/goldie/v2 v2.5.3 h1:9ES/mNN+HNUbNWpVAlrzuZ7jE+Nrczbj8uFRjM7624Y=