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
153181: workload/schemachanger: check for duplicate trigger functions r=fqazi a=fqazi
Previously, it was possible for trigger function names to collide if the workload was run mutliple times against a CRDB server. Certain tests like the mixed version tests will intentionally do this. So, before creating triggers or trigger functions we need to validate that function names do not collide.
Fixes: #152716
Release note: None
Co-authored-by: Faizan Qazi <[email protected]>
// Try to generate a random SELECT statement for more complex dependencies
5444
+
// Try to generate a random SELECT statement for more coamplex dependencies
5440
5445
selectStmt, err:=og.selectStmt(ctx, tx)
5441
5446
iferr!=nil {
5442
5447
returnnil, err
5443
5448
}
5444
5449
// Our trigger function will always return the original value to avoid
5445
5450
// breaking inserts.
5446
-
triggerFunction:=fmt.Sprintf(`CREATE FUNCTION %s() RETURNS TRIGGER AS $FUNC_BODY$ BEGIN %s;RETURN NEW;END; $FUNC_BODY$ LANGUAGE PLpgSQL`, triggerFunctionName, selectStmt.sql)
5451
+
triggerFunction:=fmt.Sprintf(`CREATE FUNCTION %s() RETURNS TRIGGER AS $FUNC_BODY$ BEGIN %s;RETURN NEW;END; $FUNC_BODY$ LANGUAGE PLpgSQL`, resolvedTriggerFunctionName, selectStmt.sql)
0 commit comments