Details
Description
This is a MySQL bug, but as you know I prefer not to give lots of my personal data to Oracle.
As far as I can tell, error 1758 seems to have not a SQLSTATE:
MariaDB [(none)]> \W Show warnings enabled. MariaDB [(none)]> GET DIAGNOSTICS CONDITION 0 @a = MYSQL_ERRNO; Query OK, 0 rows affected, 1 warning (0.10 sec) Error (Code 1758): Invalid condition number
From the documentation, SQLSTATE should be '35000':
http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html
This causes some trivial problems:
- DECLARE HANDLER FOR '35000' doesnt handle it
- Same for SQLEXCEPTION and other classes
- mysqld reports it as a warning, not an error (see above)
Gliffy Diagrams
Attachments
Issue Links
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Hi Federico,
Could you please help me understand how your example shows that there is no SQLSTATE for 1758? From what I see, it's there all right:
Reporting it as a warning rather than an error is apparently intentional, at least it's documented (http://dev.mysql.com/doc/refman/5.6/en/get-diagnostics.html):
"A warning occurs if the condition number is not in the range from 1 to the number of condition areas that have information. In this case, the warning is added to the diagnostics area without clearing it."
The fact that it's not handled by a handler is another story. I'd think it's not because of the SQLSTATE, it looks like the warning somehow gets lost (suppressed?) if it happens inside a procedure:
MariaDB [test]> drop procedure if exists p; Query OK, 0 rows affected (0.01 sec) MariaDB [test]> delimiter || MariaDB [test]> create procedure p() -> begin -> GET DIAGNOSTICS CONDITION 0 @a = MYSQL_ERRNO ; -> end || Query OK, 0 rows affected (0.01 sec) MariaDB [test]> delimiter ; MariaDB [test]> MariaDB [test]> call p(); Query OK, 0 rows affected (0.01 sec) MariaDB [test]>(no warning caused by the procedure call).
I'm not quite sure if it's a bug or not (haven't found it in the documentation yet), if you think it is, we might try to create a bug report at Oracle and see what they say.