[MDEV-13912] mysql_upgrade: case (in)sensitivity for stored procedures Created: 2017-09-26  Updated: 2018-10-28  Resolved: 2018-10-28

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 5.5.57
Fix Version/s: 5.5.62, 10.0.37, 10.3.11, 10.1.37, 10.2.19

Type: Bug Priority: Major
Reporter: Michal Schorm Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

Fedora - all
RHEL7


Sprint: 5.5.58

 Description   

TL;DR:

  • Create first procedure in one database
  • Create second procedure in different database
  • ALTER TABLE proc CONVERT TO CHARACTER SET utf8;
    --> error

Actual code:

[root@test]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.26-MariaDB MariaDB Server
 
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> use test
Database changed
MariaDB [test]> DELIMITER |
MariaDB [test]> CREATE PROCEDURE getStudents()
    -> BEGIN
    ->  SELECT * FROM students;
    -> END|
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> DELIMITER ;
MariaDB [test]> create database TEST;
Query OK, 1 row affected (0.00 sec)
 
MariaDB [test]> use TEST
Database changed
MariaDB [TEST]> DELIMITER |
MariaDB [TEST]> 
MariaDB [TEST]> CREATE PROCEDURE getStudents()
    -> BEGIN
    ->  SELECT * FROM students;
    -> END|
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [TEST]> DELIMITER ;
MariaDB [TEST]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
MariaDB [mysql]> select db,name,type from proc;
+-------+--------------------+-----------+
| db    | name               | type      |
+-------+--------------------+-----------+
| TEST  | getStudents        | PROCEDURE |
| mysql | AddGeometryColumn  | PROCEDURE |
| mysql | DropGeometryColumn | PROCEDURE |
| test  | getStudents        | PROCEDURE |
+-------+--------------------+-----------+
4 rows in set (0.00 sec)
 
MariaDB [mysql]> ALTER TABLE proc CONVERT TO CHARACTER SET utf8;
ERROR 1062 (23000): Duplicate entry 'TEST-getStudents-PROCEDURE' for key 'PRIMARY'
 
MariaDB [mysql]>

There is a bug report to RHEL, you can check:
https://bugzilla.redhat.com/show_bug.cgi?id=1490398
However the issue is reproducible pretty well anywhere in any MDB version.

That is obviously a pretty unpleasant when using mysql_upgrade on bigger projects.



 Comments   
Comment by Michal Schorm [ 2017-09-26 ]

Seems like I found simmilar: MDEV-8960

I'll stick to it and inform you, if it solved my issue (which probably will)

Comment by Michal Schorm [ 2017-09-26 ]

Ok,
I think, that the issue I linked is the exact same problem, however it was not resolved in MDB 5.5.
The patch is only partly applicable for MDB 5.5.

Can you please fix in 5.5 too?

Comment by Elena Stepanova [ 2017-09-30 ]

I'll leave it to serg and jplindst to decide whether we are going to do it in 5.5.

Comment by Michal Schorm [ 2017-10-02 ]

Ok.

I would be glad, because I have a customer that wants this to work in MDB 5.5 on RHEL 7.

Comment by Michal Schorm [ 2017-10-18 ]

Can you please check this one?

use test
DELIMITER |
 
CREATE PROCEDURE getStudents()
BEGIN
 SELECT * FROM students;
END|
 
DELIMITER ;
create database TEST;
use TEST
DELIMITER |
 
CREATE PROCEDURE getStudents()
BEGIN
 SELECT * FROM students;
END|
 
DELIMITER ;
use mysql
select db,name,type from proc;
 
ALTER TABLE proc CONVERT TO CHARACTER SET utf8;

.

I still get this result with 5.5.58:

[root@test_machine tmp]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.58-MariaDB MariaDB Server
 
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
 
MariaDB [(none)]> use test
Database changed
MariaDB [test]> DELIMITER |
MariaDB [test]> 
MariaDB [test]> CREATE PROCEDURE getStudents()
    -> BEGIN
    ->  SELECT * FROM students;
    -> END|
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> 
MariaDB [test]> DELIMITER ;
MariaDB [test]> create database TEST;
Query OK, 1 row affected (0.00 sec)
 
MariaDB [test]> use TEST
Database changed
MariaDB [TEST]> DELIMITER |
MariaDB [TEST]> 
MariaDB [TEST]> CREATE PROCEDURE getStudents()
    -> BEGIN
    ->  SELECT * FROM students;
    -> END|
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [TEST]> 
MariaDB [TEST]> DELIMITER ;
MariaDB [TEST]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
MariaDB [mysql]> select db,name,type from proc;
+------+-------------+-----------+
| db   | name        | type      |
+------+-------------+-----------+
| TEST | getStudents | PROCEDURE |
| test | getStudents | PROCEDURE |
+------+-------------+-----------+
2 rows in set (0.00 sec)
 
MariaDB [mysql]> 
MariaDB [mysql]> ALTER TABLE proc CONVERT TO CHARACTER SET utf8;
ERROR 1062 (23000): Duplicate entry 'TEST-getStudents-PROCEDURE' for key 'PRIMARY'

Comment by Sergei Golubchik [ 2018-01-04 ]

I've backported MDEV-8960 as earlier comments suggested.

But it didn't fix the issue in question, because MDEV-8960 (Can't refer the same column twice in one ALTER TABLE) doesn't seem to have anything to do with ALTER TABLE proc CONVERT TO CHARACTER SET.

Comment by Michal Schorm [ 2018-01-04 ]

Affect 10.2.11 too, reproducible the exact same way.

Comment by Michal Schorm [ 2018-02-18 ]

Any update for MariaDB 5.5?

Comment by Michal Schorm [ 2018-10-10 ]

Hello, what's the current state?
I still wait on this issue to be solved, with a customer behind me.

Is it possible to include it to the 5.5.62 release?
Is tahere any mor information I can help with?

Generated at Thu Feb 08 08:09:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.