I am facing a very annoying PSQL issue when trying to load part of a PostgreSQL table via a subquery.
The query is :
SELECT
N1,
N2,
N3,
N4
FROM CORR
WHERE CORR_N5 >= (now() - interval '18 year')
AND CORR_N5 <= (now() - interval '18 year' + interval '1 month')
This one works if written directly in PgAdmin. However when I run it from a spark 2 job, I get tho following error message :
org.postgresql.util.PSQLException: ERROR: subquery in FROM must have an alias
Hint: For example, FROM (SELECT ...) [AS] foo.
Even when I put an alias after all the clauses, the same issue happens.
Any advice ?
Thanks in advance