summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-02-07 02:39:40 +0200
committerMonty <monty@mariadb.org>2018-02-07 02:39:40 +0200
commit6ba06cf763a72b5b812fd7eadc076fdf31910c56 (patch)
tree7cabead8b39b533f2af87cb3de1344d8074f6a5d /scripts
parenta0417ccc3af2d33c84f306111aa4eb51baf0594f (diff)
downloadmariadb-git-6ba06cf763a72b5b812fd7eadc076fdf31910c56.tar.gz
On upgrade Truncate_versioning_privilege was not correct set
Fixed that Truncate_versioning_privilege works as any other privilege during upgrade: - If the privilege field does not exists, add it to the user and db tables. If the user had super_privilege then the user will also get the new Truncate_versioning_privilege. This is done to ensure that if one has GRANT ALL PRIVILEGE before, one will continue to have it after running mysql_upgrade. This also fixes a bug where the Truncate_versioning_privilege
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mysql_system_tables_fix.sql21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 44a95483564..39277f8975c 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -645,6 +645,21 @@ ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_genera
UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0;
+#
+# System versioning
+#
+
+SET @had_truncate_versioning_priv := 0;
+SELECT @had_truncate_versioning_priv :=1 FROM user WHERE Truncate_versioning_priv LIKE '%';
+
+ALTER TABLE user add Truncate_versioning_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Create_tablespace_priv;
+ALTER TABLE user modify Truncate_versioning_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';
+ALTER TABLE db add Truncate_versioning_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Trigger_priv;
+ALTER TABLE db modify Truncate_versioning_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';
+
+UPDATE user SET Truncate_versioning_priv = Super_priv WHERE @had_truncate_versioning_priv = 0;
+
+
ALTER TABLE user ADD plugin char(64) DEFAULT '', ADD authentication_string TEXT;
ALTER TABLE user ADD password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
@@ -744,9 +759,3 @@ ALTER TABLE help_topic MODIFY url TEXT NOT NULL;
# MDEV-7383 - varbinary on mix/max of column_stats
alter table column_stats modify min_value varbinary(255) DEFAULT NULL, modify max_value varbinary(255) DEFAULT NULL;
-
-# System versioning
-ALTER TABLE user add Truncate_versioning_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Trigger_priv;
-ALTER TABLE user modify Truncate_versioning_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';
-ALTER TABLE db add Truncate_versioning_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Trigger_priv;
-ALTER TABLE db modify Truncate_versioning_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';