[MDEV-15150] Error using "IF EXISTS" clause on DROP FUNCTION Created: 2018-01-31  Updated: 2018-02-05  Resolved: 2018-02-05

Status: Closed
Project: MariaDB Server
Component/s: Admin statements
Affects Version/s: 10.1.30
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: David Villalobos Cambronero Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Linux, Mageia, 64 bits


Attachments: File configFile.tar.gz     Text File global_variables.txt     File my.cnf     File proc.MYD     File proc.MYI     File proc.frm     File sql_errors.log    

 Description   

Execute: "DROP FUNCTION IF EXISTS `UTN_EnvioCorreo`;" and the function does not exists show the error: "Could not execute statement. Error: 1728 Cannot load from mysql.proc. The table is probably corrupted"



 Comments   
Comment by Elena Stepanova [ 2018-01-31 ]

Please run CHECK TABLE mysql.proc.

Comment by David Villalobos Cambronero [ 2018-01-31 ]

Hi Elena, here is the output:

--------------
CHECK TABLE mysql.proc
--------------
+------------+-------+----------+----------+
| Table      | Op    | Msg_type | Msg_text |
+------------+-------+----------+----------+
| mysql.proc | check | status   | OK       |
+------------+-------+----------+----------+
Rows in set: 1. Elapsed time: 1 milliseconds.

Comment by Elena Stepanova [ 2018-01-31 ]

And you are still getting that error after this?
If so, please attach your server error log, cnf file(s) and the full unabridged output from the client for

CHECK TABLE mysql.proc EXTENDED;
DROP FUNCTION IF EXISTS `UTN_EnvioCorreo`;

Comment by David Villalobos Cambronero [ 2018-01-31 ]

Yes I still get the error.

--------------
CHECK TABLE mysql.proc EXTENDED
--------------
+------------+-------+----------+----------+
| Table      | Op    | Msg_type | Msg_text |
+------------+-------+----------+----------+
| mysql.proc | check | status   | OK       |
+------------+-------+----------+----------+
Rows in set: 1. Elapsed time: 2 milliseconds.
--------------
DROP FUNCTION IF EXISTS `UTN_EnvioCorreo`;
--------------
+-------------------------------------------------------------------------------------------------------+
| Could not execute statement. Error: 1728 Cannot load from mysql.proc. The table is probably corrupted |
+-------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------+
Rows in set: 0. Elapsed time: 0 seconds.

sql_errors.log my.cnf sql_errors.log

Comment by Elena Stepanova [ 2018-01-31 ]

Okay, that's a bit of a mystery, on many levels. For one, your error log looks like you have a rather high log_warnings level, but nothing in the config file hints at that. Possible it's the only file, or not the only file, that the server actually uses. If that's the possibility, SHOW GLOBAL VARIABLES might help.

The partial error log is not particularly helpful, because the important part – server startup – is missing. Can you add a bigger portion, which includes at least the latest server start?
One thing you can see yourself from the error log is that IF EXISTS is irrelevant here, same error is produced on your instance on an attempt to create a function.

Could you please also paste the output of SHOW CREATE TABLE mysql.proc? And if possible, attach mysql/proc.frm, mysql/proc.MYI, mysql/proc.MYD. If you are worried that it might contain confidential information, then at least .frm (it's just the structure).

Was this instance upgraded from some other version of MariaDB/MySQL/whatever?

Comment by David Villalobos Cambronero [ 2018-01-31 ]

I attached the requested files, the error log is complete, I mean, I just Copy & Paste the whole file.

It is the default MariaDB version that comes with Mageia 6 64Bits

Hope it helps.

configFile.tar.gz global_variables.txt proc.frm proc.MYD proc.MYI

Comment by Elena Stepanova [ 2018-02-05 ]

It does help, thanks.
The table is not corrupt, it just has a wrong structure, apparently coming from a different version, looks like from MySQL, even though created by MariaDB – maybe from a backup made by mysqldump?
Anyway, you need to run mysql_upgrade, it should solve the problem. If it refuses to run saying that the instance has already been upgraded, run mysql_upgrade --force.

Comment by David Villalobos Cambronero [ 2018-02-05 ]

Hi Elena,

mysql_upgrade --force fix the problem, sorry for your time and the false bug report.

Best regards
David

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