This statement
select 'foo' in ('foo', 'bar');
returns 1 as expected.
This
select json_extract('["foo"]', '$[0]') = 'foo';
also returns 1 as expected.
However, this
select json_extract('["foo"]', '$[0]') in ('foo', 'bar');
unuexpectedly returns 0. Even more strangely, if written with additional quotes
select json_extract('["foo"]', '$[0]') in ('"foo"', '"bar"');
it returns 1 instead. But this does not work with simple equality, as
select json_extract('["foo"]', '$[0]') = '"foo"';
returns 0.
So the question is: why "IN" and "=" behave differently only when fed with JSON results?
select json_extract('["foo"]', '$[0]') in ('foo', 'bar');returns 1 on my system.... (MySQL8.0.25/Windows)