I have a table which name project (the data type of Project.id is integer):
the domain_projects column stored values which separated by comma.
As I try to execute the following SQL statement, it will occur this error
SQLState: 42883, No operator matches the given name and argument type(s). You might need to add explicit type casts.
select * from project where id in (select unnest(string_to_array( (select domain_projects from project where id = :projectId), ',')))
How-To
Owing to the return type of unnest function is set of any element, the result should be casted to integer to match project.id.
Hence, the updated SQL statement is as bellows:
select * from project where id in (select cast(unnest(string_to_array( (select domain_projects from project where id = :projectId), ',')) as int))