How to fix syntax error at or near 'UNION' in PostgreSQL | DevErrors