insights: landing page displays sql error if no insight views exist
Created by: leonore
On a fresh local sg instance (sg start enterprise-codeinsights
), the /insights
landing page errors with ERROR: syntax error at or near ")" (SQLSTATE 42601)
if no insight views exist.
This can be fixed by first navigating to /insights/create
and creating an insight.
This error seems to come from https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/enterprise/internal/insights/store/insight_store.go?L134, where we format a SELECT query based on an id IN (%s)
where the query is executed even if there are no IDs to find views for.