summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-10-28 14:28:16 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2021-10-28 14:28:50 +0200
commitea45f0ebfb2193fa5b578c1463dae79ff8940f29 (patch)
tree8d721f2dbb90ee5261a14a04777b8e7db9a6f63d
parentd8c6c53a0658ea8315252997f65d796b13182387 (diff)
downloadmariadb-git-ea45f0ebfb2193fa5b578c1463dae79ff8940f29.tar.gz
MDEV-26925 - upgrade fails creating trigger in sysschema, if root user does not exist
Fix by removing the trigger. It does not do anything useful anyway.
-rw-r--r--mysql-test/suite/funcs_1/r/is_triggers.result10
-rw-r--r--mysql-test/suite/funcs_1/r/is_triggers_embedded.result10
-rw-r--r--mysql-test/suite/sysschema/r/all_sys_objects_exist.result2
-rw-r--r--scripts/sys_schema/README.md4
-rw-r--r--scripts/sys_schema/triggers/sys_config_insert_set_user.sql11
-rw-r--r--scripts/sys_schema/triggers/sys_config_update_set_user.sql12
6 files changed, 1 insertions, 48 deletions
diff --git a/mysql-test/suite/funcs_1/r/is_triggers.result b/mysql-test/suite/funcs_1/r/is_triggers.result
index d29200980a0..c6485e58f44 100644
--- a/mysql-test/suite/funcs_1/r/is_triggers.result
+++ b/mysql-test/suite/funcs_1/r/is_triggers.result
@@ -110,16 +110,6 @@ ORDER BY trigger_schema, trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
def mtr gs_insert INSERT def mtr global_suppressions 1 NULL BEGIN DECLARE dummy INT; SELECT "" REGEXP NEW.pattern INTO dummy; END ROW BEFORE NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
def mtr ts_insert INSERT def mtr test_suppressions 1 NULL BEGIN DECLARE dummy INT; SELECT "" REGEXP NEW.pattern INTO dummy; END ROW BEFORE NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-def sys sys_config_insert_set_user INSERT def sys sys_config 1 NULL BEGIN
- IF @sys.ignore_sys_config_triggers != true AND NEW.set_by IS NULL THEN
- SET NEW.set_by = USER();
- END IF;
-END ROW BEFORE NULL NULL OLD NEW # root@localhost utf8mb3 utf8mb3_general_ci utf8mb3_general_ci
-def sys sys_config_update_set_user UPDATE def sys sys_config 1 NULL BEGIN
- IF @sys.ignore_sys_config_triggers != true AND NEW.set_by IS NULL THEN
- SET NEW.set_by = USER();
- END IF;
-END ROW BEFORE NULL NULL OLD NEW # root@localhost utf8mb3 utf8mb3_general_ci utf8mb3_general_ci
##################################################################################
# Testcase 3.2.18.2 + 3.2.18.3: INFORMATION_SCHEMA.TRIGGERS accessible information
##################################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_triggers_embedded.result b/mysql-test/suite/funcs_1/r/is_triggers_embedded.result
index 248738da4e2..5a681db49b6 100644
--- a/mysql-test/suite/funcs_1/r/is_triggers_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_triggers_embedded.result
@@ -110,16 +110,6 @@ ORDER BY trigger_schema, trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
def mtr gs_insert INSERT def mtr global_suppressions 1 NULL BEGIN DECLARE dummy INT; SELECT "" REGEXP NEW.pattern INTO dummy; END ROW BEFORE NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
def mtr ts_insert INSERT def mtr test_suppressions 1 NULL BEGIN DECLARE dummy INT; SELECT "" REGEXP NEW.pattern INTO dummy; END ROW BEFORE NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-def sys sys_config_insert_set_user INSERT def sys sys_config 1 NULL BEGIN
- IF @sys.ignore_sys_config_triggers != true AND NEW.set_by IS NULL THEN
- SET NEW.set_by = USER();
- END IF;
-END ROW BEFORE NULL NULL OLD NEW # root@localhost utf8mb3 utf8mb3_general_ci utf8mb3_general_ci
-def sys sys_config_update_set_user UPDATE def sys sys_config 1 NULL BEGIN
- IF @sys.ignore_sys_config_triggers != true AND NEW.set_by IS NULL THEN
- SET NEW.set_by = USER();
- END IF;
-END ROW BEFORE NULL NULL OLD NEW # root@localhost utf8mb3 utf8mb3_general_ci utf8mb3_general_ci
##################################################################################
# Testcase 3.2.18.2 + 3.2.18.3: INFORMATION_SCHEMA.TRIGGERS accessible information
##################################################################################
diff --git a/mysql-test/suite/sysschema/r/all_sys_objects_exist.result b/mysql-test/suite/sysschema/r/all_sys_objects_exist.result
index d89890f1747..6dddd8a186c 100644
--- a/mysql-test/suite/sysschema/r/all_sys_objects_exist.result
+++ b/mysql-test/suite/sysschema/r/all_sys_objects_exist.result
@@ -154,8 +154,6 @@ statement_performance_analyzer PROCEDURE
table_exists PROCEDURE
SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA = 'sys' ORDER BY TRIGGER_NAME;
TRIGGER_NAME
-sys_config_insert_set_user
-sys_config_update_set_user
SELECT sys_version FROM sys.version;
sys_version
1.5.1
diff --git a/scripts/sys_schema/README.md b/scripts/sys_schema/README.md
index d5f792059c3..feaf9ff5ee8 100644
--- a/scripts/sys_schema/README.md
+++ b/scripts/sys_schema/README.md
@@ -12,9 +12,7 @@ There are install files available for 5.6 and 5.7 respectively. To load these, y
##### Description
-Holds configuration options for the sys schema. This is a persistent table (using the `InnoDB` storage engine), with the configuration persisting across upgrades (new options are added with `INSERT IGNORE`).
-
-The table also has two related triggers, which maintain the user that `INSERTs` or `UPDATEs` the configuration - `sys_config_insert_set_user` and `sys_config_update_set_user` respectively.
+Holds configuration options for the sys schema. This is a persistent table, with the configuration persisting across upgrades (new options are added with `INSERT IGNORE`).
Its structure is as follows:
diff --git a/scripts/sys_schema/triggers/sys_config_insert_set_user.sql b/scripts/sys_schema/triggers/sys_config_insert_set_user.sql
index 3c5e7dbf060..3d608ace862 100644
--- a/scripts/sys_schema/triggers/sys_config_insert_set_user.sql
+++ b/scripts/sys_schema/triggers/sys_config_insert_set_user.sql
@@ -22,14 +22,3 @@
DROP TRIGGER IF EXISTS sys_config_insert_set_user;
-DELIMITER $$
-
-CREATE DEFINER='root'@'localhost' TRIGGER sys_config_insert_set_user BEFORE INSERT on sys_config
- FOR EACH ROW
-BEGIN
- IF @sys.ignore_sys_config_triggers != true AND NEW.set_by IS NULL THEN
- SET NEW.set_by = USER();
- END IF;
-END$$
-
-DELIMITER ;
diff --git a/scripts/sys_schema/triggers/sys_config_update_set_user.sql b/scripts/sys_schema/triggers/sys_config_update_set_user.sql
index 55b6ff27cf1..8b956da78ab 100644
--- a/scripts/sys_schema/triggers/sys_config_update_set_user.sql
+++ b/scripts/sys_schema/triggers/sys_config_update_set_user.sql
@@ -22,15 +22,3 @@
DROP TRIGGER IF EXISTS sys_config_update_set_user;
-
-DELIMITER $$
-
-CREATE DEFINER='root'@'localhost' TRIGGER sys_config_update_set_user BEFORE UPDATE on sys_config
- FOR EACH ROW
-BEGIN
- IF @sys.ignore_sys_config_triggers != true AND NEW.set_by IS NULL THEN
- SET NEW.set_by = USER();
- END IF;
-END$$
-
-DELIMITER ;