Search code examples
orientdb

orientdb cluster names were ok in v2.0 but are now invalid?


We recently upgraded from v2.0 to v2.1.9, and we're suddenly unable to query our clusters. This query:

 select * from cluster:tdv-st-2014-01-19

worked fine in 2.0 (and earlier), but now we get (in console and in Java API):

Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #0: Error parsing query: 
select * from cluster:tdv-st-2014-01-19
Encountered " "-" "- "" at line 1, column 26.
Was expecting one of:
    <EOF> 
    <WHERE> ...
    <ORDER> ...
    <GROUP> ...
    <LIMIT> ...
    <SKIP2> ...
    <OFFSET> ...
    <TIMEOUT> ...
    <FETCHPLAN> ...
    <LOCK> ...
    <LET> ...
    <NOCACHE> ...
    <PARALLEL> ...
    <UNWIND> ...
    ";" ...
    <LET> ...
    <WHERE> ...
    <GROUP> ...
    <ORDER> ...
    <UNWIND> ...
    <SKIP2> ...
    <OFFSET> ...
    <LIMIT> ...
    <FETCHPLAN> ...
    <TIMEOUT> ...
    <LOCK> ...
    <PARALLEL> ...
    <NOCACHE> ...

Looks like it doesn't like "-" characters in the cluster name any more? We've tried quoting the cluster name, etc. but haven't found a way to get this query to work. Anybody have an idea?


Solution

  • In the new version 2.1.x has been implemented a new 'Strict SQL parser' which brings the following new features:

    ***) - as a valid character for identifiers (property and class names): in the old implementation you could define a property name like "simple-name" and do simple-SELECT name FROM Foo. This is not allowed anymore, Because - character is used for arithmetic operations (subtract). To use names with - character, use backticks. Example: SELECT simple-name FROM Foo

    So the '-' is not a valid character for an identifier (to avoid clashes with subtraction) see link

    If you want, you can disable the new parsing setting strictSql=false (see Studio -> db tab)