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.
2663
+
///
2664
+
/// Example:
2665
+
/// ```sql
2666
+
/// CREATE OR REPLACE TRIGGER trigger_name
2667
+
/// AFTER INSERT ON table_name
2668
+
/// FOR EACH ROW
2669
+
/// EXECUTE FUNCTION trigger_function();
2670
+
/// ```
2671
+
or_replace:bool,
2672
+
/// The `CONSTRAINT` keyword is used to create a trigger as a constraint.
2673
+
is_constraint:bool,
2674
+
/// The name of the trigger to be created.
2675
+
name:ObjectName,
2676
+
/// Determines whether the function is called before, after, or instead of the event.
2677
+
///
2678
+
/// Example of BEFORE:
2679
+
///
2680
+
/// ```sql
2681
+
/// CREATE TRIGGER trigger_name
2682
+
/// BEFORE INSERT ON table_name
2683
+
/// FOR EACH ROW
2684
+
/// EXECUTE FUNCTION trigger_function();
2685
+
/// ```
2686
+
///
2687
+
/// Example of AFTER:
2688
+
///
2689
+
/// ```sql
2690
+
/// CREATE TRIGGER trigger_name
2691
+
/// AFTER INSERT ON table_name
2692
+
/// FOR EACH ROW
2693
+
/// EXECUTE FUNCTION trigger_function();
2694
+
/// ```
2695
+
///
2696
+
/// Example of INSTEAD OF:
2697
+
///
2698
+
/// ```sql
2699
+
/// CREATE TRIGGER trigger_name
2700
+
/// INSTEAD OF INSERT ON table_name
2701
+
/// FOR EACH ROW
2702
+
/// EXECUTE FUNCTION trigger_function();
2703
+
/// ```
2704
+
period:TriggerPeriod,
2705
+
/// Multiple events can be specified using OR, such as `INSERT`, `UPDATE`, `DELETE`, or `TRUNCATE`.
2706
+
events:Vec<TriggerEvent>,
2707
+
/// The table on which the trigger is to be created.
2708
+
table_name:ObjectName,
2709
+
/// The optional referenced table name that can be referenced via
2710
+
/// the `FROM` keyword.
2711
+
referenced_table_name:Option<ObjectName>,
2712
+
/// This keyword immediately precedes the declaration of one or two relation names that provide access to the transition relations of the triggering statement.
2713
+
referencing:Vec<TriggerReferencing>,
2714
+
/// This specifies whether the trigger function should be fired once for
2715
+
/// every row affected by the trigger event, or just once per SQL statement.
2716
+
trigger_object:TriggerObject,
2717
+
/// Whether to include the `EACH` term of the `FOR EACH`, as it is optional syntax.
2718
+
include_each:bool,
2719
+
/// Triggering conditions
2720
+
condition:Option<Expr>,
2721
+
/// Execute logic block
2722
+
exec_body:TriggerExecBody,
2723
+
/// The characteristic of the trigger, which include whether the trigger is `DEFERRABLE`, `INITIALLY DEFERRED`, or `INITIALLY IMMEDIATE`,
0 commit comments