The connection to PostgreSQL is initially established in a login window.
After successful login, a main window is loaded. And several SQL queries are successfully executed.
This has been working fine for quite some time and is still ok.
I have now added this new SQL query and it is the only one that returns this error that makes no sense to me.
Also, if I execute this same SQL query manually in connection1 within the project, it works without error. The error only occurs when the program is running.
It seems that the structure of THIS SQL query is supported in connection1 but, when the program is running, another control is used and this one does not support the structure of THIS SQL query well.