Skip to content
  • Grégory Mantelet's avatar
    [ADQL] Add to the parser a function attempting to quickly fix an ADQL query. · 15cd5944
    Grégory Mantelet authored
    This new function - ADQLParser.tryQuickFix(...) - fixes the most common issues
    with ADQL queries:
    
    - replace Unicode confusable characters by their ASCII/UTF-8 version,
    - double-quote SQL reserved words/terms (e.g. `public`, `year`, `date`),
    - double-quote ADQL function names used a column name/alias (e.g. `distance`,
      `min`, `avg`),
    - double-quote invalid regular identifiers (e.g. `_RAJ2000`, `2mass`).
    
    The last point is far from being perfect but should work at least for
    identifiers starting with a digit or an underscore, or an identifier including
    one of the following character: `?`, `!`, `$`, `@`, `#`, `{`, `}`, `[`, `]`,
    `~`, `^` and '`'.
    
    It should also been noted that double-quoting a column/table name will make it
    case-sensitive. Then, it is possible that the query does not pass even after the
    double-quote operation ; the case would have to be checked by the user.
    
    Finally, there is no attempt to fix column and table names (i.e. case
    sensitivity and/or typos) using tables/columns list/metadata. That could be a
    possible evolution of this function or an additional feature to implement in the
    parser.
    15cd5944