Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insight SQL Error Unsupported function call 'FROM(...)' #29058

Open
YoshuaAditya opened this issue Feb 21, 2025 · 1 comment
Open

Insight SQL Error Unsupported function call 'FROM(...)' #29058

YoshuaAditya opened this issue Feb 21, 2025 · 1 comment
Labels
bug Something isn't working right

Comments

@YoshuaAditya
Copy link

Bug Description

Bug description

I am using Insight SQL to get the average time users spent on mobile screen. Previously using this query works (about a month ago)

SELECT date as time, avg(distinct time_on_screen) AS avg_time_on_screen,
    gender
FROM (
  SELECT 
    toDate(first_timestamp) as date,
    sum(dateDiff('second', first_timestamp, next_timestamp)) over (PARTITION by date, gender,user_id) AS time_on_screen,
    gender,
    user_id,
  FROM (
    SELECT
      distinct_id,
      event AS first_event,
      timestamp AS first_timestamp,
      first_value(event) OVER w AS next_event,
      first_value(timestamp) OVER w AS next_timestamp,
      properties.$screen_name as screen,
      properties.page as page,
      person.properties.gender as gender,
      person.id as user_id,
    FROM events
    WHERE
      timestamp > now() - INTERVAL 14 DAY
    WINDOW w AS (PARTITION BY distinct_id ORDER BY timestamp ASC ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING)
    ORDER BY distinct_id, timestamp
  ) AS subquery
  WHERE first_event = 'restaurant_view'
  AND (next_event = '$app_close' OR next_event = '$screen')
)
group by time,gender
ORDER BY time,gender

But now it gives me Unsupported function call 'FROM(...)' error
Image

Debug info

- [x] PostHog Cloud, Debug information: 
Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/019528a5-6326-7315-aa6e-320bcc4945f1?t=368
Admin: http://go/adminOrgUS/0193d327-b5c8-0000-b979-4444ef04a5fd (project ID 111920)
Sentry: http://go/sentryUS/111920
@YoshuaAditya YoshuaAditya added the bug Something isn't working right label Feb 21, 2025
@YoshuaAditya
Copy link
Author

Okay, found the issue.
Removing comma from user_id, into user_id makes it working again. Though I'm not sure why it is not consistent for trailing commas, since person.id as user_id, works without error.
Leaving this open in case someone else has the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right
Projects
None yet
Development

No branches or pull requests

1 participant