On 09/01/2018 01:14, Mats Eklund wrote:
Need some help here. I have the following expression:
SELECT IF(1=1, 0x2, 0x4) | 0x1
which in MySQL evaluates to: 3
but in MariaDB it evaluates to: 1
MySQL's result seems correct to me. Would appreciate any advice on this.
This is related to the change made in 10.0.3. See: https://mariadb.com/kb/en/library/hexadecimal-literals/ Also see the explanation in: https://jira.mariadb.org/browse/MDEV-6092 If you specifically CAST it as a number it will work as you expect, for example SELECT IF(1=1, CAST(0x2 AS UNSIGNED), CAST(0x4 AS UNSIGNED)) | 0x1; +-------------------------------------------------------------+ | IF(1=1, CAST(0x2 AS UNSIGNED), CAST(0x4 AS UNSIGNED)) | 0x1 | +-------------------------------------------------------------+ | 3 | +-------------------------------------------------------------+