1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-27124: Update definer of Add/DropGeometryColumn procedures from 'root' to 'mariadb.sys'

From 10.4.13, the `mariadb.sys` user was created to replace `root` definers.
 - In commit 0253ea7f22, definer of
   Add/DropGeometryColumn procedures was changed to `mariadb.sys`, in
   `scripts/maria_add_gis_sp.sql.in`.
   However, maria_add_gis_sp.sql only applies to new databases created by
   installation script. Databases upgraded from old versions will miss this
   change.
 - In addition, according to commit
   0d6d801e5886208b2632247d88da106a543e1032(MDEV-23102), in some scenarios
   when root user is replaced it will skip creating `mariadb.sys` user.

This commit is to update the definer from `root` to `mariadb.sys` during
upgrade. It only makes the change if the original definers are root.

Doesn't choose to execute `maria_add_gis_sp.sql` in upgrade script to
recreate the procedures is because of considering the scenarios of
MDEV-23102 that `root` user is replaced and `mariadb.sys` is not created.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
This commit is contained in:
Hugo Wen
2021-10-15 23:20:48 +00:00
committed by Daniel Black
parent b53ee760ff
commit e9572e53e6
3 changed files with 194 additions and 0 deletions

View File

@ -510,6 +510,11 @@ ALTER TABLE proc MODIFY comment
ALTER TABLE proc ADD aggregate enum('NONE', 'GROUP') DEFAULT 'NONE' NOT NULL
AFTER body_utf8;
# Update definer of Add/DropGeometryColumn procedures to 'mariadb.sys'
# To consider the scenarios in MDEV-23102, only update the definer when it's 'root'
UPDATE proc SET Definer = 'mariadb.sys@localhost' WHERE Definer = 'root@localhost' AND Name = 'AddGeometryColumn';
UPDATE proc SET Definer = 'mariadb.sys@localhost' WHERE Definer = 'root@localhost' AND Name = 'DropGeometryColumn';
#
# EVENT privilege
#