mirror of
https://github.com/umami-software/umami.git
synced 2026-05-30 06:47:25 +00:00
fix: add explicit AS keyword for PostgreSQL column alias in session and event queries
The session and event expanded metrics queries use implicit column
aliasing (`${column} name`) which causes a PostgreSQL syntax error
when the column name (like `os`) is followed by `name` without `AS`.
PostgreSQL parses `os name` ambiguously and fails with:
syntax error at or near "name"
The sibling file getPageviewExpandedMetrics.ts already uses the correct
`${column} as name` pattern. This applies the same fix to the session
and event queries.
Fixes #3970
This commit is contained in:
@@ -58,7 +58,7 @@ async function relationalQuery(
|
||||
sum(${getTimestampDiffSQL('t.min_time', 't.max_time')}) as "totaltime"
|
||||
from (
|
||||
select
|
||||
${column} name,
|
||||
${column} as name,
|
||||
website_event.session_id,
|
||||
website_event.visit_id,
|
||||
count(*) as "c",
|
||||
|
||||
@@ -65,7 +65,7 @@ async function relationalQuery(
|
||||
sum(${getTimestampDiffSQL('t.min_time', 't.max_time')}) as "totaltime"
|
||||
from (
|
||||
select
|
||||
${column} name,
|
||||
${column} as name,
|
||||
${includeCountry ? 'country,' : ''}
|
||||
website_event.session_id,
|
||||
website_event.visit_id,
|
||||
|
||||
Reference in New Issue
Block a user