SQL API: aggregate queries through PostgreSQL wire protocol throw TypeError: m.split is not a function
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
### Bug
Any SQL query with aggregate functions (MAX, SUM, COUNT, GROUP BY) sent through the PostgreSQL wire protocol (SQL API) fails with `TypeError: m.split is not a function`. Non‑aggregate queries (`SELECT col1, col2 FROM view LIMIT N`) work fine.
### To reproduce
1. Start `cubejs/cube:latest` connected to any database with a view
2. Connect via the PostgreSQL wire protocol and run:
```sql
SELECT MAX(col) FROM some_view
```
3. Observe error:
```
Internal Error: TypeError: m.split is not a function
```
### Expected
`SELECT MAX(col) FROM view` should return the aggregated result, same as the REST API.
### Environment
- Cube.js version: 1.7.10 (`cubejs/cube:latest`, pulled Jul 25 2026)
- Database driver: Trino
- SQL API type: PostgreSQL wire protocol (native `@cubejs-backend/native` crate)
Contributor guide
Research direction
Start by reproducing the aggregate query through the PostgreSQL wire protocol using the native @cubejs-backend/native crate, then compare it with a working non-aggregate query and the REST API result. Trace where the aggregate query is handled and identify why it reaches the m.split TypeError; done means MAX, SUM, COUNT, and GROUP BY queries return results like the REST API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, rust, sql
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100