#7626·questdb

Sample by should error without a timestamp

Author: javierCreated Sep 15, 2026Updated Sep 17, 2026
LabelsBugSQL

To reproduce

I wouldn't expect this query to work, but it doesn't fail. I think it is internally casting the result of max(price) as a timestamp, but the result is not shown as a timestamp, and nothing makes sense.

select  max(price) from (select price from trades where timestamp in '$today')
 sample by 1m;

If you force a timestamp conversion, you can see what is going on there.

select  max(price)::timestamp from (select price from trades where timestamp in '$today')
 sample by 1m;

I am fine with this second query, as we are explicitly using a timestamp (even if in this case price doesn't make sense), and it could power use cases like select max(timestamp) from trades sample by 1m;. But I think the first version with no cast should error.

QuestDB version:

10.0.1

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

demo box

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

demo box

Full Name:

javier

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