Actually the correct approach for Postgres equal to or greater than 9.3 would be to use the FDW extension. If you do not have it installed, install with
CREATE EXTENSION postgres_fdw;
Then you create a reference to your remote server using that extension:
CREATE SERVER servidor_remoto
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host 'IP', dbname 'mibase');
Then you create a mapping of users such that one of your local users equals a remote user. If the remote user usersuport
already has permissions on public
then you can map the local user myuser
with the remote user:
CREATE USER MAPPING FOR myuser
SERVER servidor_remoto
OPTIONS (user 'usersuport', password 'xxx');
Then you "mount" a remote schema in a local schema (I do not remember if you have to create the local schema or it is created explicitly). The important thing is that with this approach all the tables in the remote schema are mapped to FOREIGN TABLES in the local schema:
IMPORT FOREIGN SCHEMA public
FROM SERVER servidor_remoto
INTO esquema_public_remoto;
And finally, you can give your local user permissions on the tables in your local schema:
GRANT SELECT on all tables in schema esquema_public_remoto to myuser;
That below would make your local user execute the select without your local DB to say: "Moment, you do not have permission on this scheme", but also, since before you mapped it to a remote user, once that the schema allows it to do the select, in addition the remote server is not going to say to him: "moment, here there is nobody that is called myuser".