Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[influxdb] Error on retrieval of data with non-standard retention policy name (escape issue) #10398

Closed
DrTron opened this issue Mar 27, 2021 · 0 comments · Fixed by #11139
Closed
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@DrTron
Copy link

DrTron commented Mar 27, 2021

Ever since I migrated to OH3 (now on OH3.1M2), I am no longer able to retrieve historical data from influxdb (1.8). OH3 does, however, persist all the data into the database.

To limit the influxdb size, I am using it as a round-robin-database, and created new retention policies. The default one is named "1m_for_24h", and while this is a valid influxdb name (and works for inserting data into the database from the binding), the binding fails to correctly escape the underscores when retrieving data.

A minimal example from a rule to retrieve data from 10 Minutes ago would be:
item.historicState(now.minusMinutes(10),"influxdb")

The query generated by this is:
SELECT value FROM 1m_for_24h.item WHERE time <= '2021-03-26T01:41:27.811737Z' ORDER BY time DESC LIMIT 1;
which gives the following error:
19:19:18.284 [ERROR] [.internal.handler.ScriptActionHandler] - Script execution of rule with UID 'influxtest-1' failed: error parsing query: found 1m, expected identifier at line 1, char 19 in influxtest

Modifying the query to the correct escape sequence like this:
SELECT value FROM "1m_for_24h".item WHERE time <= '2021-03-26T01:41:27.811737Z' ORDER BY time DESC LIMIT 1;
results in correctly retrieving data from the database.

@DrTron DrTron added the bug An unexpected problem or unintended behavior of an add-on label Mar 27, 2021
fremel75 added a commit to fremel75/openhab-addons that referenced this issue Aug 21, 2021
fremel75 added a commit to fremel75/openhab-addons that referenced this issue Aug 21, 2021
…le names containing InfluxQL keywords or special characters
fremel75 added a commit to fremel75/openhab-addons that referenced this issue Aug 21, 2021
…le names containing InfluxQL keywords or special characters

Signed-off-by: fremel@gmail.com <fremel@gmail.com>
fremel75 added a commit to fremel75/openhab-addons that referenced this issue Aug 21, 2021
… and table names containing InfluxQL keywords or special characters"

This reverts commit 57e93ac.
fremel75 added a commit to fremel75/openhab-addons that referenced this issue Aug 21, 2021
… and table names containing InfluxQL keywords or special characters"

This reverts commit 30d8c74.
fremel75 added a commit to fremel75/openhab-addons that referenced this issue Aug 21, 2021
… and table names containing InfluxQL keywords or special characters"

This reverts commit 57e93ac.
fwolter added a commit that referenced this issue May 29, 2022
…ywords or special chars (#11139)

* [influxdbv1] #9790 and #10398 Fix for retention and table names containing InfluxQL keywords or special characters

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Revert escaped qoutes on null items

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Apply suggestions from code review

Signed-off-by: Fabian Wolter <github@fabian-wolter.de>

Co-authored-by: Joan Pujol <joanpujol@gmail.com>

* Apply spotless

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

Co-authored-by: Fabian Wolter <github@fabian-wolter.de>
Co-authored-by: Joan Pujol <joanpujol@gmail.com>
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk>
leifbladt pushed a commit to leifbladt/openhab-addons that referenced this issue Oct 15, 2022
…ywords or special chars (openhab#11139)

* [influxdbv1] openhab#9790 and openhab#10398 Fix for retention and table names containing InfluxQL keywords or special characters

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Revert escaped qoutes on null items

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Apply suggestions from code review

Signed-off-by: Fabian Wolter <github@fabian-wolter.de>

Co-authored-by: Joan Pujol <joanpujol@gmail.com>

* Apply spotless

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

Co-authored-by: Fabian Wolter <github@fabian-wolter.de>
Co-authored-by: Joan Pujol <joanpujol@gmail.com>
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk>
andan67 pushed a commit to andan67/openhab-addons that referenced this issue Nov 6, 2022
…ywords or special chars (openhab#11139)

* [influxdbv1] openhab#9790 and openhab#10398 Fix for retention and table names containing InfluxQL keywords or special characters

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Revert escaped qoutes on null items

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Apply suggestions from code review

Signed-off-by: Fabian Wolter <github@fabian-wolter.de>

Co-authored-by: Joan Pujol <joanpujol@gmail.com>

* Apply spotless

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

Co-authored-by: Fabian Wolter <github@fabian-wolter.de>
Co-authored-by: Joan Pujol <joanpujol@gmail.com>
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk>
andrasU pushed a commit to andrasU/openhab-addons that referenced this issue Nov 12, 2022
…ywords or special chars (openhab#11139)

* [influxdbv1] openhab#9790 and openhab#10398 Fix for retention and table names containing InfluxQL keywords or special characters

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Revert escaped qoutes on null items

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Apply suggestions from code review

Signed-off-by: Fabian Wolter <github@fabian-wolter.de>

Co-authored-by: Joan Pujol <joanpujol@gmail.com>

* Apply spotless

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

Co-authored-by: Fabian Wolter <github@fabian-wolter.de>
Co-authored-by: Joan Pujol <joanpujol@gmail.com>
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
psmedley pushed a commit to psmedley/openhab-addons that referenced this issue Feb 23, 2023
…ywords or special chars (openhab#11139)

* [influxdbv1] openhab#9790 and openhab#10398 Fix for retention and table names containing InfluxQL keywords or special characters

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Revert escaped qoutes on null items

Signed-off-by: fremel@gmail.com <fremel@gmail.com>

* Apply suggestions from code review

Signed-off-by: Fabian Wolter <github@fabian-wolter.de>

Co-authored-by: Joan Pujol <joanpujol@gmail.com>

* Apply spotless

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

Co-authored-by: Fabian Wolter <github@fabian-wolter.de>
Co-authored-by: Joan Pujol <joanpujol@gmail.com>
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
1 participant