Skip to content

spurious 'undeclared variable' error #6002

@jerrinot

Description

@jerrinot

To reproduce

Logs from the demo:

2025-07-30T10:06:03.305357Z E i.q.g.e.QueryProgress err [id=-1, sql=
DECLARE
  @symbol := 'BTC-USDT'
WITH sampled AS (
    SELECT
          timestamp,  symbol,
          volume AS volume,
          ((open+close)/2) * volume AS traded_value
     FROM trades_OHLC_15m
     WHERE timestamp BETWEEN '2025-07-28T22:00:00Z' AND '2025-07-29T21:59:59.999Z' 
     AND symbol = @symbol      
), cumulative AS (
     SELECT timestamp, symbol,
           SUM(traded_value)
                OVER (ORDER BY timestamp) AS cumulative_value,
           SUM(volume)
                OVER (ORDER BY timestamp) AS cumulative_volume
     FROM sampled
)
SELECT timestamp as time, cumulative_value/cumulative_volume AS vwap_yesterday FROM cumulative;
, principal=admin, cache=false, jit=true, time=186213, msg=tried to use undeclared variable volume, errno=0, pos=148]

This makes no sense, since volume is not a variable in this query.

QuestDB version:

9.0.1

OS, in case of Docker specify Docker and the Host OS:

irrelevant

File System, in case of Docker specify Host File System:

irrelevant

Full Name:

Jaromir Hamala

Affiliation:

QuestDB

Have you followed Linux, MacOs kernel configuration steps to increase Maximum open files and Maximum virtual memory areas limit?

  • Yes, I have

Additional context

No response

Metadata

Metadata

Assignees

Labels

BugIncorrect or unexpected behaviorJavaImprovements that update Java code

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions