Skip to main content

parse_view_ddl

Function parse_view_ddl 

Source
pub fn parse_view_ddl(sql: &str) -> Result<Option<ViewDdl>>
Expand description

Ok(None) when sql is not view DDL – the overwhelmingly common case, decided by a cheap keyword peek before any full parse. Err when the hand-rolled parse does not reach EOF right after <name> WITH (...) (or, on DROP, right after the single name): an unmodelled clause, an AS body, a second DROP name, or a second statement each would otherwise silently do less than the statement says.

Returns a plain anyhow::Result rather than a typed error enum: this crate’s convention (rust/CLAUDE.md) is to use anyhow unless a caller needs to branch on the error kind, and execute_query’s only caller here never does – it always maps the error into a client-facing invalid_argument Status.