I know this is a bit of a far-fetched question, but is it in any way possible to do following?
select cc.schema,
(select exists(select *
from (select cc.schema).helpers cs
where cs.chain_id=cc.id)
) as hasHelpers
from customer.chain cc
where cc.id=$1
What I'm trying to do is convert cc.schema
to the schema name in the exists statement! Is this possible and how?
If I try to run the statement above I get an error:
subquery in FROM must have an alias .... from (select cc...