bombsimon commented on code in PR #1884:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1884#discussion_r2150350430
##########
src/ast/mod.rs:
##########
@@ -2982,6 +2982,63 @@ impl From<Set> for Statement {
}
}
+/// An exception representing exception handling with the `EXCEPTION` keyword.
+///
+/// Snowflake:
<https://docs.snowflake.com/en/sql-reference/snowflake-scripting/exception>
+/// BigQuery:
<https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#beginexceptionend>
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub struct Exception {
+ pub when: Vec<ExceptionWhen>,
+ pub raises: Option<Box<Statement>>,
Review Comment:
Added a description.
Initially I used `Option<Option<Ident>>` because you can either do bare
`RAISE` which re-reases the exception currently handled _or_ you can do `RASIE
SOME_EXCEPTION` which reaises `SOME_EXCEPTION`.
For BigQuery however this is a bit more complex, there you can something
like this which was solved by using the already existing
[`parse_raise_stmt`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#raise).
```sql
RAISE USING MESSAGE = FORMAT('Some issue: %s', i)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]