Skip to content

Conversation

@rkoh-rq
Copy link

@rkoh-rq rkoh-rq commented Nov 4, 2025

Fixes PostgreSQL syntax error by quoting the "event" column alias. This was causing the journey query to fail.

"event" is a reserved keyword in PostgreSQL. Added double quotes to treat it as an identifier rather than a keyword.

Changes:

  • Quote "event" in PostgreSQL
  • Quote "event" in ClickHouse for consistency

Fixes PostgreSQL syntax error by quoting the "event" column alias. This was causing the journey query to fail.

"event" is a reserved keyword in PostgreSQL. Added double quotes to treat it as an identifier rather than a keyword.

Changes:
- Quote "event" in PostgreSQL
- Quote "event" in ClickHouse for consistency
@vercel
Copy link

vercel bot commented Nov 4, 2025

@rkoh-rq is attempting to deploy a commit to the umami-software Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

Fixed a critical PostgreSQL syntax error by properly quoting the event column alias. event is a reserved keyword in PostgreSQL, causing the journey query to fail. The fix quotes event in both PostgreSQL and ClickHouse implementations for consistency.

Changes:

  • Added double quotes around event in CASE statement (lines 75, 185)
  • Added double quotes around event column alias in CTE (lines 121, 230)
  • Applied to both relationalQuery (PostgreSQL) and clickhouseQuery functions

The fix is minimal, targeted, and maintains consistency across both database implementations.

Confidence Score: 5/5

  • This PR is safe to merge - it's a straightforward fix for a SQL syntax error
  • The change correctly addresses a PostgreSQL reserved keyword issue with a standard solution (identifier quoting). The fix is applied consistently to both database backends (PostgreSQL and ClickHouse), maintains the same query logic, and only modifies the necessary identifiers. This is a minimal, non-breaking change that resolves a runtime error
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/queries/sql/reports/getJourney.ts 5/5 Fixed PostgreSQL reserved keyword issue by quoting event column alias in both PostgreSQL and ClickHouse queries

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Journey API Route
    participant Query as getJourney
    participant DB as Database (PostgreSQL/ClickHouse)
    
    Client->>API: POST /api/reports/journey
    API->>API: Validate request (steps: 3-7)
    API->>API: Check authorization
    API->>Query: getJourney(websiteId, filters)
    Query->>Query: Route to relationalQuery or clickhouseQuery
    Query->>Query: Build dynamic SQL with quoted "event" alias
    Note over Query: CASE WHEN event_number = i THEN "event" ELSE NULL END
    Query->>DB: Execute CTE with events and sequences
    DB->>Query: Return journey sequences
    Query->>Query: parseResult & combineSequentialDuplicates
    Query->>API: Return formatted journey data
    API->>Client: JSON response with journey items and counts
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant