I have a query in which I want to take all columns from a table, but modify the time field. As an example, here I get all fields in my table but subtract one month from the timestamp.
select "system", sensor, sensordesc, avg(energy) as energy, avg(voltage) as voltage,
dateadd('M', -1, "timestamp") as "timestamp", vbus, sensorname
from "emporia"
where timestamp in '2024-11-24' sample by 10m
It works perfectly except that the final column of my SELECT (“sensordesc”) does not get returned. I get all columns up to and including “vbus” correctly. Odd and inconsistent things happen for any columns I place in the SELECT list after the DATEADD() function.
If I specify the column name twice, then it all works and I get all the columns as requested, with the column I asked for twice only appearing once. I.e., the following command does what I was expecting from the original command, returning every column once.
select "system", sensor, sensordesc, avg(energy) as energy, avg(voltage) as voltage,
dateadd('M', -1, "timestamp") as "timestamp", vbus, sensorname, sensorname
from "emporia"
where timestamp in '2024-11-24' sample by 10m
Is this expected behaviour? I could not find anything in the docs about not using dateadd() in SELECT lists.
QuestDB 8.1.4 running in a docker using image “questdb/questdb:latest”