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.
3203
+
///
3204
+
/// Example:
3205
+
/// ```sql
3206
+
/// CREATE OR REPLACE TRIGGER trigger_name
3207
+
/// AFTER INSERT ON table_name
3208
+
/// FOR EACH ROW
3209
+
/// EXECUTE FUNCTION trigger_function();
3210
+
/// ```
3211
+
pubor_replace:bool,
3212
+
/// The `CONSTRAINT` keyword is used to create a trigger as a constraint.
3213
+
pubis_constraint:bool,
3214
+
/// The name of the trigger to be created.
3215
+
pubname:ObjectName,
3216
+
/// Determines whether the function is called before, after, or instead of the event.
3217
+
///
3218
+
/// Example of BEFORE:
3219
+
///
3220
+
/// ```sql
3221
+
/// CREATE TRIGGER trigger_name
3222
+
/// BEFORE INSERT ON table_name
3223
+
/// FOR EACH ROW
3224
+
/// EXECUTE FUNCTION trigger_function();
3225
+
/// ```
3226
+
///
3227
+
/// Example of AFTER:
3228
+
///
3229
+
/// ```sql
3230
+
/// CREATE TRIGGER trigger_name
3231
+
/// AFTER INSERT ON table_name
3232
+
/// FOR EACH ROW
3233
+
/// EXECUTE FUNCTION trigger_function();
3234
+
/// ```
3235
+
///
3236
+
/// Example of INSTEAD OF:
3237
+
///
3238
+
/// ```sql
3239
+
/// CREATE TRIGGER trigger_name
3240
+
/// INSTEAD OF INSERT ON table_name
3241
+
/// FOR EACH ROW
3242
+
/// EXECUTE FUNCTION trigger_function();
3243
+
/// ```
3244
+
pubperiod:TriggerPeriod,
3245
+
/// Whether the trigger period was specified before the target table name.
3246
+
///
3247
+
/// ```sql
3248
+
/// -- period_before_table == true: Postgres, MySQL, and standard SQL
3249
+
/// CREATE TRIGGER t BEFORE INSERT ON table_name ...;
3250
+
/// -- period_before_table == false: MSSQL
3251
+
/// CREATE TRIGGER t ON table_name BEFORE INSERT ...;
3252
+
/// ```
3253
+
pubperiod_before_table:bool,
3254
+
/// Multiple events can be specified using OR, such as `INSERT`, `UPDATE`, `DELETE`, or `TRUNCATE`.
3255
+
pubevents:Vec<TriggerEvent>,
3256
+
/// The table on which the trigger is to be created.
3257
+
pubtable_name:ObjectName,
3258
+
/// The optional referenced table name that can be referenced via
3259
+
/// the `FROM` keyword.
3260
+
pubreferenced_table_name:Option<ObjectName>,
3261
+
/// This keyword immediately precedes the declaration of one or two relation names that provide access to the transition relations of the triggering statement.
3262
+
pubreferencing:Vec<TriggerReferencing>,
3263
+
/// This specifies whether the trigger function should be fired once for
3264
+
/// every row affected by the trigger event, or just once per SQL statement.
3265
+
pubtrigger_object:TriggerObject,
3266
+
/// Whether to include the `EACH` term of the `FOR EACH`, as it is optional syntax.
3267
+
pubinclude_each:bool,
3268
+
/// Triggering conditions
3269
+
pubcondition:Option<Expr>,
3270
+
/// Execute logic block
3271
+
pubexec_body:Option<TriggerExecBody>,
3272
+
/// For MSSQL and dialects where statements are preceded by `AS`
3273
+
pubstatements_as:bool,
3274
+
/// For SQL dialects with statement(s) for a body
3275
+
pubstatements:Option<ConditionalStatements>,
3276
+
/// The characteristic of the trigger, which include whether the trigger is `DEFERRABLE`, `INITIALLY DEFERRED`, or `INITIALLY IMMEDIATE`,
0 commit comments