You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// The `OR REPLACE` clause is used to re-create the trigger if it already exists.
2642
+
///
2643
+
/// Example:
2644
+
/// ```sql
2645
+
/// CREATE OR REPLACE TRIGGER trigger_name
2646
+
/// AFTER INSERT ON table_name
2647
+
/// FOR EACH ROW
2648
+
/// EXECUTE FUNCTION trigger_function();
2649
+
/// ```
2650
+
or_replace:bool,
2651
+
/// The `CONSTRAINT` keyword is used to create a trigger as a constraint.
2652
+
is_constraint:bool,
2653
+
/// The name of the trigger to be created.
2654
+
name:ObjectName,
2655
+
/// Determines whether the function is called before, after, or instead of the event.
2656
+
///
2657
+
/// Example of BEFORE:
2658
+
///
2659
+
/// ```sql
2660
+
/// CREATE TRIGGER trigger_name
2661
+
/// BEFORE INSERT ON table_name
2662
+
/// FOR EACH ROW
2663
+
/// EXECUTE FUNCTION trigger_function();
2664
+
/// ```
2665
+
///
2666
+
/// Example of AFTER:
2667
+
///
2668
+
/// ```sql
2669
+
/// CREATE TRIGGER trigger_name
2670
+
/// AFTER INSERT ON table_name
2671
+
/// FOR EACH ROW
2672
+
/// EXECUTE FUNCTION trigger_function();
2673
+
/// ```
2674
+
///
2675
+
/// Example of INSTEAD OF:
2676
+
///
2677
+
/// ```sql
2678
+
/// CREATE TRIGGER trigger_name
2679
+
/// INSTEAD OF INSERT ON table_name
2680
+
/// FOR EACH ROW
2681
+
/// EXECUTE FUNCTION trigger_function();
2682
+
/// ```
2683
+
period:TriggerPeriod,
2684
+
/// Multiple events can be specified using OR, such as `INSERT`, `UPDATE`, `DELETE`, or `TRUNCATE`.
2685
+
events:Vec<TriggerEvent>,
2686
+
/// The table on which the trigger is to be created.
2687
+
table_name:ObjectName,
2688
+
/// The optional referenced table name that can be referenced via
2689
+
/// the `FROM` keyword.
2690
+
referenced_table_name:Option<ObjectName>,
2691
+
/// This keyword immediately precedes the declaration of one or two relation names that provide access to the transition relations of the triggering statement.
2692
+
referencing:Vec<TriggerReferencing>,
2693
+
/// This specifies whether the trigger function should be fired once for
2694
+
/// every row affected by the trigger event, or just once per SQL statement.
2695
+
trigger_object:TriggerObject,
2696
+
/// Whether to include the `EACH` term of the `FOR EACH`, as it is optional syntax.
2697
+
include_each:bool,
2698
+
/// Triggering conditions
2699
+
condition:Option<Expr>,
2700
+
/// Execute logic block
2701
+
exec_body:TriggerExecBody,
2702
+
/// The characteristic of the trigger, which include whether the trigger is `DEFERRABLE`, `INITIALLY DEFERRED`, or `INITIALLY IMMEDIATE`,
0 commit comments