Handle DROP VIEW cleanup and robust SQL parser spans#21
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18f928eaed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let end = parse_qualified_name_span(sql, idx)?; | ||
| if !is_statement_tail(sql, end) { | ||
| return None; | ||
| } | ||
| extract_last_qualified_identifier(&sql[idx..end]) |
There was a problem hiding this comment.
Preserve schema when dropping measure views
This parser drops schema qualification by returning only the last identifier from DROP VIEW names, so DROP VIEW analytics.orders_v is treated the same as DROP VIEW orders_v. Because the catalog delete is keyed only by that unqualified name, a drop against a different schema can remove the wrong measure metadata and break subsequent AGGREGATE(...) queries for the still-existing view. Keep the full qualified name (or reject qualified drops) when mapping DROP statements to measure-view cleanup.
Useful? React with 👍 / 👎.
Summary