-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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] Fix for influxdbv1 retention and table names containing keywords or special chars #11139
Conversation
…le names containing InfluxQL keywords or special characters Signed-off-by: fremel@gmail.com <fremel@gmail.com>
IIRC item names are not allowed to start with a number. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I think that the retentionPolicy doesn't need to be escaped because it's covered by the appendName
function logic.
About the tablename it's ok to escape for the default keyword that isn't covered by the appendName
but only when escapeTableName
is true.
When it's false it's because tableName it's /.*/
and it must not be escaped.
Signed-off-by: fremel@gmail.com <fremel@gmail.com>
Thanks for the feedback But the appendName function doesent seem to work for this properly i guess since its not escaped? From influx code |
The way it is now looks good to me, except that I think that the escaping inside the Can you provide a case where it isn't working with the inputs? |
I have tested with "default" as retention name since this is a keyword now for the default retention in influx.
And with my item named "1WireOutsideTempSensor_Temperature"
or by rest api I see now that Documentation for Openhab states "Names must not begin with number" i did create this in Webui so i thought it was ok and in rrd4j it was working |
But with current PR code the retentionPolicy isn't escaped, isn't it? |
|
Excuseme, my last comment was incorrect, I wanted to say, the retentionPolicy is escaped, isn't it? But, despite my mistake, I think that we have some confusion in the latests comments. For my the actual PR is ok, I only think that the doublequotes inside the When you say that you have problems, do you mean with this PR code or with actual code? |
First i experience no problems with the PR |
I don't understand what do you mean with: That's the code of the appended function:
Can you debug or check logs and say for which input it doesn't work? |
No it escapes the doubleqoutes also something that appendName function does not do
No its not i have no idea where you found that but i have showed the function in #11139 (comment)
Tests here #11139 (comment) I dont care about this anymore, feel free to close this PR You should close these also and tell them that item or retention starting with numbers is not allowed |
Thanks, @fremel75 , and I'm sorry you are disappointed. I previously had understood the need for the default keyword, but didn't understand some of the comments and also I got confused because I didn't remember that Thank you a lot for your patience and comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
...org/openhab/persistence/influxdb/internal/influx1/Influx1FilterCriteriaQueryCreatorImpl.java
Outdated
Show resolved
Hide resolved
...org/openhab/persistence/influxdb/internal/influx1/Influx1FilterCriteriaQueryCreatorImpl.java
Outdated
Show resolved
Hide resolved
Excuseme after accepting I've seen that better to don't use the Appender.appendName in that cases, because it has no sense as with the |
Signed-off-by: Fabian Wolter <github@fabian-wolter.de> Co-authored-by: Joan Pujol <joanpujol@gmail.com>
@lujop Your proposed changes are now part of this PR. Are you confident that these will work? Can you test them? |
Hi fwolter, I'm pretty sure, but I hadn't time to test. |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/js-scripting-previousstate/130432/21 |
@fwolter I've done some little tests and it seems to work and escape it's done: |
There are some formatting issues. You can fix them with |
@lujop could you fix the formatting to get this build going? |
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…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>
…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>
…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>
…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>
Bugfix for using itemnames beginning with numbers or having retention namnes beginning with numbers
Also solves if using old db where retention was named default wich is now a influxQL keyword
Resolves #9790
Resolves #10398
Added doubleqoutes for retention and table name as documentation for influxQL states
https://docs.influxdata.com/influxdb/v1.8/query_language/spec/#identifiers