Skip to content

Reconsider reserved words in the CLI #20

@jobarr-amzn

Description

@jobarr-amzn

When executing a query like the below, the field Time has to be quoted as "Time" in all contexts because Time is one of the SQL reserved words and that's reflected in the partiql-lang-rust lexer.

Does not work

PartiQL> select Time/1000000.0 as "ms", RequestId, Operation from read_ion('service_log.2023-05-30-19.ion') as e where RequestId is not NULL limit 10;

  × Error for query `select Time/1000000.0 as "ms", RequestId, Operation from read_ion('service_log.2023-05-30-19.ion') as e
  │ where RequestId is not NULL limit 10`

Error:   × PartiQL syntax error:
   ╭────
 1 │ select Time/1000000.0 as "ms", RequestId, Operation from read_ion('service_log.2023-05-30-19.ion') as e where RequestId is not NULL limit 10
   ·            ┬
   ·            ╰── Unexpected token `/`
   ╰────

Does work

PartiQL> select "Time"/1000000.0 as "ms", RequestId, Operation from read_ion('service_log.2023-05-30-19.ion') as e where RequestId is not NULL

Some of the words in that list seem like they'll be very common as field/column names in real data, especially "value", "time", and "date". Those don't feel like keywords to my muscle memory, and from the list of SQL reserved words on Wikipedia it seems like several large RDBMSs may agree.

I think it would be worth it to allow at least those three identifiers to be used without requiring a quoted identifier, so I'm filing this issue to prompt a discussion.

Please feel free to edit/discard this issue as appropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions