Skip to content

Commit d382ad2

Browse files
authored
Merge pull request #3682 from rkoh-rq/patch-1
fix: quote "event" reserved keyword in journey queries
2 parents cc82549 + b1dc690 commit d382ad2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/queries/sql/reports/getJourney.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async function relationalQuery(
7373
for (let i = 1; i <= steps; i++) {
7474
const endQuery = i < steps ? ',' : '';
7575
selectQuery += `s.e${i},`;
76-
maxQuery += `\nmax(CASE WHEN event_number = ${i} THEN event ELSE NULL END) AS e${i}${endQuery}`;
76+
maxQuery += `\nmax(CASE WHEN event_number = ${i} THEN "event" ELSE NULL END) AS e${i}${endQuery}`;
7777
groupByQuery += `s.e${i}${endQuery} `;
7878
}
7979

@@ -185,7 +185,7 @@ async function clickhouseQuery(
185185
for (let i = 1; i <= steps; i++) {
186186
const endQuery = i < steps ? ',' : '';
187187
selectQuery += `s.e${i},`;
188-
maxQuery += `\nmax(CASE WHEN event_number = ${i} THEN event ELSE NULL END) AS e${i}${endQuery}`;
188+
maxQuery += `\nmax(CASE WHEN event_number = ${i} THEN "event" ELSE NULL END) AS e${i}${endQuery}`;
189189
groupByQuery += `s.e${i}${endQuery} `;
190190
}
191191

@@ -230,7 +230,7 @@ async function clickhouseQuery(
230230
WITH events AS (
231231
select distinct
232232
visit_id,
233-
coalesce(nullIf(event_name, ''), url_path) event,
233+
coalesce(nullIf(event_name, ''), url_path) "event",
234234
row_number() OVER (PARTITION BY visit_id ORDER BY created_at) AS event_number
235235
from website_event
236236
${cohortQuery}

0 commit comments

Comments
 (0)