Now...what you are executing using the function returning a string is:
SELECT * FROM debug_644 WHERE code IN (''1','8','7','15'');
so you are not looking for codes having either of your values in your string but for one containing exactly the result of your function (including commas and quotes).
there are plenty of entries in this forum that will guide how to:
- split a string into pieces
- do generic in lists