Postgresql 12. In a function returning a SELECT result of table A and B, when the function input Boolean parameter is true, do
select * from A INNER join B on A.id = B.id;
when the parameter is false, do
select * from A LEFT join B on A.id = B.id;
checked case-when-end but it doesn't work in "where". Is there any way to achieve this without writing two separate SELECT?

