If you’re getting “ERROR: missing FROM-clause entry for table” in PostgreSQL when using an operator such as UNION, INTERSECT, or EXCEPT, it could be because you’re qualifying a column name with its table name.
To fix this, either remove the table name or use a column alias.