BIGINT UNSIGNED with LEAST() or GREATEST() : Unexpected result
Below codes are showing LEAST() and GREATEST() function with both BIGINT UNSIGNED parameters.
Tested with MariaDB 10.3.12 and DBeaver 21.3.5
Is this bug of MariaDB?
Is there any solution?
Please help me.
------------------------------------------------------------------------------------ CODE TO REPRODUCE : ------------------------------------------------------------------------------------ DELIMITER $$ BEGIN NOT ATOMIC DECLARE ABC BIGINT UNSIGNED DEFAULT 18446744073709551615; -- BIGINT UNSIGNED MAX DECLARE XYZ BIGINT UNSIGNED DEFAULT 0; -- BIGINT UNSIGNED MIN SELECT LEAST(ABC,XYZ), GREATEST(ABC,XYZ), LEAST(ABC,0), GREATEST(ABC,0); END; $$ DELIMITER ; ------------------------------------------------------------------------------------ RESULT : ------------------------------------------------------------------------------------ |Bug? |Bug? |Valid |Valid | |--------------------|-----------------|------------|--------------------| |LEAST(ABC,XYZ) |GREATEST(ABC,XYZ)|LEAST(ABC,0)|GREATEST(ABC,0) | |--------------------|-----------------|------------|--------------------| |18446744073709551615|0 |0 |18446744073709551615| --------------------------------------------------------------------------
Answer Answered by Daniel Black in this comment.
I agree, it looks really odd. MDEV-28001 written covering this.
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.