Bug #118157 Depricated warning bug "Setting user variables within expressions is deprecated"

Submitted: 9 May 2025 12:35 Modified: 19 Jun 2025 10:42
Reporter: Justin Levene Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.4.5 OS:Any
Assigned to: CPU Architecture:Any

[9 May 2025 12:35] Justin Levene
Description:
In a procedure or function I have something to the following (ignore syntax errors as this is rough):

create procedure `test`()
modifies SQL DATA
BEGIN
declare _x bigint unsigned;
declare _y bigint unsigned;
....
select `pos_x`, `pos_y` from `table` where `ID`=10 into _x, _y;
....
END

The above select causes the deprecated warning when the code is allowed and supported according to the doc https://dev.mysql.com/doc/refman/8.4/en/select-into.html

How to repeat:
Do a select into a declared user variable like above inside a function or procedure.  When you execute the create, you get the deprecated warning.

Suggested fix:
Remove the warning as it is incorrect.  It is not critical, just misleading.
[20 May 2025 12:35] MySQL Verification Team
Hello Justin Levene,

Thank you for the bug report.
I tried to reproduce your issue on windows 11 with MySQL Server 8.4.5 and followed exact procedure but I am not seeing any issues at my end.

Regards,
Ashwini Patil
[19 Jun 2025 10:42] Justin Levene
CREATE PROCEDURE `test`()
    MODIFIES SQL DATA
BEGIN
    # Establishing starting numbers for all root elements.
    UPDATE `tmp_tree`
	SET `LFT` = @startID := @startID + 1,
		`RGT` = @startID := @startID +1
	WHERE `parent_id` IS NULL
	AND `LFT` IS NULL
	AND `RGT` IS NULL
	ORDER BY `idx` desc;
END;;

and also:

CREATE TRIGGER `hms_main_AFTER_UPDATE` AFTER UPDATE ON `hms_main` FOR EACH ROW
BEGIN
	set @i=0;
	update `test` set `TIME`=DATE_ADD(now(6), INTERVAL @i:=@i+1 MICROSECOND);
END ;;

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.