[MDEV-16326] Warning 4094 has a very confusing message Created: 2018-05-30  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: Federico Razzoli Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: warning


 Description   

When warning 4094 occurs, I see messages like this:

Note (Code 4094): At line 8 in test.test0

This makes the warning confusing and not helpful. To add confusion, this warning is not listed in the relevant documentation pages:

I'm not adding a test case because you already have several test cases where 4094 is supposed to occur.



 Comments   
Comment by Federico Razzoli [ 2018-05-30 ]

I have a strong feeling that I'm seeing this warning far too many times when testing stored aggregate functions. But without an error message it's hard for me to say if the bug is in MariaDB or in my tests. So I'll wait for a fix here.

Comment by Sergei Golubchik [ 2018-06-21 ]

It's ER_SP_STACK_TRACE. The error message is, precisely, "At line %u in %s". As far as I can see from the tests, it happens as

 Warnings:
 Error	1062	Duplicate entry '23' for key 'a'
 Note	4070	At line 4 in test.f2

 Level	Code	Message
 Warning	1012	Raising a warning
 Error	5555	RESIGNAL to not found
 Note	4070	At line 9 in test.test_resignal

 Error	9999	Variable 'sql_mode' can't be set to the value of 'NULL'
 Note	4070	At line 8 in test.peter_p1

The message is pretty clear if you know what it means, but I agree that on itself it's quite puzzling.

We need at least to document it, but also, perhaps, to reword to be less confusing.

Comment by Sergei Golubchik [ 2018-06-21 ]

What about "Error %u at line %u in %s"? It'd be, say

 Warnings:
 Error	1062	Duplicate entry '23' for key 'a'
 Note	4070	Error 1062 at line 4 in test.f2

Comment by Elena Stepanova [ 2018-07-19 ]

I guess it's as good as anything. The current one is confusing because it does look like something is missing.
f_razzoli, but according to the above, you should also be getting some error along with the note. What is it?

Comment by Federico Razzoli [ 2018-07-19 ]

Time passed and I cannot find out easily. But actually you already pointed out the problem: if you know what it means, it's clear... otherwise it means nothing. Documenting it would make it more useful, and would make clear that the "poor" message is not a bug.

Comment by Elena Stepanova [ 2018-09-04 ]

I assume we agreed on changing the error message as above.

Comment by Jörg Schierstein [ 2020-02-22 ]

/*-- Testcase for
-----------------------------------------
– | @sqlstate | @errno | @text |
-----------------------------------------
– | HY000 | 4094 | At line 5 in test.Divide |
-----------------------------------------*/

DELIMITER ;;
CREATE OR REPLACE PROCEDURE Divide(IN numerator INT, IN denominator INT, OUT result double)
BEGIN
DECLARE division_by_zero CONDITION FOR SQLSTATE '22012';
DECLARE CONTINUE HANDLER FOR division_by_zero
RESIGNAL SET MESSAGE_TEXT = 'Division by zero / Denominator cannot be zero';
IF denominator = 0 THEN
SIGNAL division_by_zero;
ELSE
SET result := numerator / denominator;
END IF;
END;
;;
delimiter ;
CALL Divide(10,0,@result);
GET DIAGNOSTICS @num_conditions = NUMBER;
SELECT @num_conditions;
GET DIAGNOSTICS CONDITION 2 @sqlstate = RETURNED_SQLSTATE,
@errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
SELECT @sqlstate, @errno, @text;

Comment by Elena Stepanova [ 2021-10-15 ]

serg, rucha174,
maybe now is a good time to do the rewording? I've kept maintenance releases in the fix version field for now, but I suppose fixing it in 10.7 should suffice.

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