iffyio commented on code in PR #2026:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2026#discussion_r2336020877
##########
src/ast/mod.rs:
##########
@@ -3914,114 +3914,10 @@ pub enum Statement {
/// 3.
[BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement)
/// 4.
[MsSql](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql)
CreateFunction(CreateFunction),
- /// CREATE TRIGGER
- ///
- /// Examples:
- ///
- /// ```sql
- /// CREATE TRIGGER trigger_name
- /// BEFORE INSERT ON table_name
- /// FOR EACH ROW
- /// EXECUTE FUNCTION trigger_function();
- /// ```
- ///
- /// Postgres:
<https://www.postgresql.org/docs/current/sql-createtrigger.html>
- /// SQL Server:
<https://learn.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql>
- CreateTrigger {
- /// True if this is a `CREATE OR ALTER TRIGGER` statement
- ///
- ///
[MsSql](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql?view=sql-server-ver16#arguments)
- or_alter: bool,
- /// The `OR REPLACE` clause is used to re-create the trigger if it
already exists.
- ///
- /// Example:
- /// ```sql
- /// CREATE OR REPLACE TRIGGER trigger_name
- /// AFTER INSERT ON table_name
- /// FOR EACH ROW
- /// EXECUTE FUNCTION trigger_function();
- /// ```
- or_replace: bool,
- /// The `CONSTRAINT` keyword is used to create a trigger as a
constraint.
- is_constraint: bool,
- /// The name of the trigger to be created.
- name: ObjectName,
- /// Determines whether the function is called before, after, or
instead of the event.
- ///
- /// Example of BEFORE:
- ///
- /// ```sql
- /// CREATE TRIGGER trigger_name
- /// BEFORE INSERT ON table_name
- /// FOR EACH ROW
- /// EXECUTE FUNCTION trigger_function();
- /// ```
- ///
- /// Example of AFTER:
- ///
- /// ```sql
- /// CREATE TRIGGER trigger_name
- /// AFTER INSERT ON table_name
- /// FOR EACH ROW
- /// EXECUTE FUNCTION trigger_function();
- /// ```
- ///
- /// Example of INSTEAD OF:
- ///
- /// ```sql
- /// CREATE TRIGGER trigger_name
- /// INSTEAD OF INSERT ON table_name
- /// FOR EACH ROW
- /// EXECUTE FUNCTION trigger_function();
- /// ```
- period: TriggerPeriod,
- /// Whether the trigger period was specified before the target table
name.
- ///
- /// ```sql
- /// -- period_before_table == true: Postgres, MySQL, and standard SQL
- /// CREATE TRIGGER t BEFORE INSERT ON table_name ...;
- /// -- period_before_table == false: MSSQL
- /// CREATE TRIGGER t ON table_name BEFORE INSERT ...;
- /// ```
- period_before_table: bool,
- /// Multiple events can be specified using OR, such as `INSERT`,
`UPDATE`, `DELETE`, or `TRUNCATE`.
- events: Vec<TriggerEvent>,
- /// The table on which the trigger is to be created.
- table_name: ObjectName,
- /// The optional referenced table name that can be referenced via
- /// the `FROM` keyword.
- referenced_table_name: Option<ObjectName>,
- /// This keyword immediately precedes the declaration of one or two
relation names that provide access to the transition relations of the
triggering statement.
- referencing: Vec<TriggerReferencing>,
- /// This specifies whether the trigger function should be fired once
for
- /// every row affected by the trigger event, or just once per SQL
statement.
- trigger_object: TriggerObject,
- /// Whether to include the `EACH` term of the `FOR EACH`, as it is
optional syntax.
- include_each: bool,
- /// Triggering conditions
- condition: Option<Expr>,
- /// Execute logic block
- exec_body: Option<TriggerExecBody>,
- /// For MSSQL and dialects where statements are preceded by `AS`
- statements_as: bool,
- /// For SQL dialects with statement(s) for a body
- statements: Option<ConditionalStatements>,
- /// The characteristic of the trigger, which include whether the
trigger is `DEFERRABLE`, `INITIALLY DEFERRED`, or `INITIALLY IMMEDIATE`,
- characteristics: Option<ConstraintCharacteristics>,
- },
- /// DROP TRIGGER
- ///
- /// ```sql
- /// DROP TRIGGER [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]
- /// ```
- ///
- DropTrigger {
- if_exists: bool,
- trigger_name: ObjectName,
- table_name: Option<ObjectName>,
- /// `CASCADE` or `RESTRICT`
- option: Option<ReferentialAction>,
- },
+ /// CREATE TRIGGER statement. See struct `CreateTrigger` for details.
+ CreateTrigger(CreateTrigger),
+ /// DROP TRIGGER statement. See struct `DropTrigger` for details.
Review Comment:
```suggestion
/// CREATE TRIGGER statement. See struct [CreateTrigger] for details.
CreateTrigger(CreateTrigger),
/// DROP TRIGGER statement. See struct [DropTrigger] for details.
```
Thinking we can use this syntax so that it turns into a hyperlink in the
rendered docs?
--
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]