Using regular expressions (regex) in continuous query (and standard queries)

Ok, I found the answer:

SELECT only returns values of same datatype for same field name. If the first value “selected” is of type string, then only other values of type string are returned.

This is neither mentioned in documention of the SELECT statement nor in other, related documentation like the FAQ.

So, basically, the problem is the very (too) simple scheme OpenHAB uses for it’s “influxdb persistance” where all values are put into an extra measurement with one field named “value” and the datatype of the corresponding openhab item.

So, my solution is to select the field name “value” instead of * and to explicitly state the value’s datetype:

cq_sevendays    CREATE CONTINUOUS QUERY cq_sevendays ON openhab_db BEGIN SELECT mean(value::float) AS value, min(val
ue::float), max(value::float) INTO openhab_db.oneyear.:MEASUREMENT FROM openhab_db.sevendays./.*/ GROUP BY time(15m)
, * END
cq_oneyear      CREATE CONTINUOUS QUERY cq_oneyear ON openhab_db BEGIN SELECT mean(value::float) AS value, min(min::
float), max(max::float) INTO openhab_db.forever.:MEASUREMENT FROM openhab_db.oneyear./.*/ GROUP BY time(1d), * END

This leaves out the string (that represnents an enum) values - however, that’s exactly what I wanted anyhow - but originally planned to take care in a later step.