-
Notifications
You must be signed in to change notification settings - Fork 715
Closed
Milestone
Description
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
Labels
No labels