Skip to content

EXTENSION is not treated as a keyword #785

@EdgyEdgemond

Description

@EdgyEdgemond
stmt = "DROP EXTENSION pgcrypto"
sqlparse.parse(stmt)

>> [[<DDL 'DROP' at 0x7882C5B725C0>, <Whitespace ' ' at 0x7882C5B72620>, <Identifier 'EXTENSION pgcrypto' at 0x7882C5C28360>, <Punctuation ';' at 0x7882C5B71CC0>]]

Rather than EXTENSION being picked up like TABLE, INDEX etc are it is picked up as a raw identifier.

This leads to brittle token fetching like this:

        idx, action = parsed.token_next_by(
            m=[
                (sqlparse.tokens.Keyword, "TABLE"),
                (sqlparse.tokens.Keyword, "AGGREGATE"),
                (sqlparse.tokens.Keyword, "INDEX"),
                (None, "EXTENSION"),
            ],
        )

Would be nice if it was treated the same as other CREATE|DROP [xxx] statements. Hopefully I've not completely misunderstood how to deal with extensions :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions