I have this bug happening only on the production server (of course). I'm not able to replicate this on any machine.
Let's say I have to perform a query made like this
INSERT INTO my_table(UUID, Name, Surname) SELECT UUID(), Name, Surname FROM other_table
I expect to have a different UUID for any new generated row, that is exactly what happens in any environment. Except production.
There, if I run that query, MySQL generates all identical UUID. Looks like that, instead of generating a new one for every row, it runs the function only once and then replicates the value.
I'm pretty sure it's due to some kind of configuration, but I can't understand which one.
Also, it might not be strictly MySQL related: if I run the query from my PC but on the production server using SQLyog, the query works fine and generates all different UUIDs.
Could it be PHP fault? I'm currently using mysqli driver.
Just to make it clear, if I run this query from my PC
SELECT UUID()
FROM (SELECT 1 AS id UNION ALL
SELECT 1 AS id UNION ALL
SELECT 1 AS id UNION ALL
SELECT 1 AS id UNION ALL
SELECT 1 AS id UNION ALL
SELECT 1 AS id UNION ALL
SELECT 1 AS id UNION ALL
SELECT 1 AS id UNION ALL
SELECT 1 AS id UNION ALL
SELECT 1 AS id
) i
the result is
bb79716f-f0ba-11e9-a154-f23c91fbfa4a
bb79717a-f0ba-11e9-a154-f23c91fbfa4a
bb79717c-f0ba-11e9-a154-f23c91fbfa4a
bb79717e-f0ba-11e9-a154-f23c91fbfa4a
bb79717f-f0ba-11e9-a154-f23c91fbfa4a
bb797181-f0ba-11e9-a154-f23c91fbfa4a
bb797183-f0ba-11e9-a154-f23c91fbfa4a
bb797185-f0ba-11e9-a154-f23c91fbfa4a
bb797187-f0ba-11e9-a154-f23c91fbfa4a
bb797189-f0ba-11e9-a154-f23c91fbfa4a
But if I run the same query using PHP on the server, the result is
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79
0aef9b78-f0bc-11e9-bfe5-7a7919257c79