By accident I created two database tables with quoted names. One was quoted with single quotes ie: ‘database’ and the other with double quotes ie: “database”.
Influx lets me create, show and use databases with quoted names but will not let me delete them.
The command: drop database “database” does not produce an error but does nothing.
The command: drop database “database” or drop database ““database”” produces a parsing error “found , expected identifier…”
A system that lets a user create a database with a quoted database name ought to also allow you to drop it.
I’m using the latest Docker container version which is shown as 1.7.
Yes, I tried all sorts of escaping and none worked. If I used the actual database name including the quotes there is no error but it does not drop the database.
Here are my test cases and the results. If you substitute a single quote (’) for the double quote (") then the results re the same.
“database_name” - no error but does nothing
“database_name” - parsing error
““database_name”” - parsing error
““database_name”” - parsing error
““database_name”” - parsing error
I’m not familiar with GO but it can’t be that hard to read so I’m going to check the CLI and see if I can find the problem. (wish me luck!).
UPDATE: I tried to create a database with a quoted name using the CLI and you can’t - it ignores the request and does not create a database. I checked the parser and it treats the database name the same for create and drop.
So, I then realised that I am using Telegraf. I am using the MQTT plug-in and I use a TAG with the required database name. This allows me to separate my MQTT data from various sources into separate databases. During my testing, I had a lot of problems getting the TAGs to work properly and tried a lot of permutations including quoted database names. So, the problem is that Telegraf passes a quoted database name to Influx and Influx (the API?) carries out the request. In my view this is a bug.
It is not clear where the fault is (more code to read tonight!) but that is how I created the databases with quoted names in the first place. I would still like to remove those quoted databases somehow…
Yes, I tried all sorts of escaping and none worked. If I used the actual
database name including the quotes there is no error but it does not drop
the database.
Here are my test cases and the results. If you substitute a single quote
(') for the double quote (") then the results re the same.
“database_name” - no error but does nothing
"database_name" - parsing error
"“database_name"” - parsing error