posthog
posthog copied to clipboard
People View broken when using HogQL
Bug Description
Bug description
The People View doesn't work when using a custom HogQL query. For example, with the custom breakdown query ifNull(cutToFirstSignificantSubdomain(properties.server), '')
the following error appears:
From my testing, this happens no matter the query - as long as it's using HogQL. Meanwhile, if using a property from the "Event properties" list PostHog provides by default, the People View works as normal.
I've checked logs of the server while doing this, and no error appears.
How to reproduce
- Create Insight
- Breakdown by a custom HogQL query
- Click on the graph to open people view
Debug info
- [x] PostHog Hobby self-hosted with
docker compose
, version/commit: 19e7d28595
Full error text if of use:
Illegal type (Nullable(String)) of 2 argument of function and: While processing ((team_id AS team_id) = 1) AND (event = 'joined server') AND (toTimeZone(timestamp AS timestamp, 'UTC') >= toDateTime('2024-05-05 00:00:00', 'UTC')) AND (toTimeZone(timestamp, 'UTC') <= toDateTime('2024-05-05 23:59:59', 'UTC')) AND ((NOT has(['localhost'], replaceRegexpAll(JSONExtractRaw(properties, 'server'), '^"|"$', ''))) AND cutToFirstSignificantSubdomain(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(properties AS properties, 'server'), ''), 'null'), '^"|"$', ''))).
Hey, what happens if you try the other way around, like cutToFirstSignificantSubdomain(properties.server ?? '')
(you can use ??
instead of ifNull
)
@mariusandra Thank you for the suggestion. I've just tried this, but the error persists - this time with Illegal type (String) of 2 argument of function and: While processing ((team_id AS team_id) = 1) AND (event = 'joined server') AND (toTimeZone(timestamp AS timestamp, 'UTC') >= toDateTime('2024-05-07 00:00:00', 'UTC')) AND (toTimeZone(timestamp, 'UTC') <= toDateTime('2024-05-07 23:59:59', 'UTC')) AND ((NOT has(['localhost'], replaceRegexpAll(JSONExtractRaw(properties, 'server'), '^"|"$', ''))) AND cutToFirstSignificantSubdomain(ifNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(properties AS properties, 'server'), ''), 'null'), '^"|"$', ''), ''))).
.
Only difference seemingly being Nullable(String) changing to String. I don't believe it's related to the type, but more just using HogQL.
Just found this related issue (#17270), seems to have been a problem for a while