1

I m getting some problem while using postgres_fdw.

    CREATE SERVER foreign_server
    FOREIGN DATA WRAPPER postgres_fdw
    OPTIONS (host '192.162.0.1', port '5432', dbname 'Test');



    CREATE USER MAPPING FOR postgres
    SERVER foreign_server
    OPTIONS (user 'foreign_user', password 'password');


    CREATE FOREIGN TABLE foreign_table (
    id serial NOT NULL,
    data text)SERVER foreign_server
    OPTIONS (schema_name 'public', table_name 'employee');


    select * from employee  where user ='foreign_user'

Now I can see entries are made to pg_foreign_data_wrapper, pg_foreign_server and pg_foreign_table tables.
But how do I access employee table of remote system.

I mean select * from employee where user ='foreign_user' doesn't give any result. Though it has data in Employee table of remote system.

Any idea please?

1
  • 2
    select * from foreign_table Commented Apr 18, 2015 at 3:43

1 Answer 1

2

But How do I access employee table of remote system.

You just need to access the foreign table, say "SELECT * FROM foreign_table;".

The procedure seems fine, but your foreign table doesn't have a column named "user", so your query must cause an error.

It would be better to show what has happened actually. Showing actual query and error messages helps us understand where the problem is.

Sign up to request clarification or add additional context in comments.

1 Comment

Hello s87. Welcome to SO. Much of this answer is really a comment, that should be left as a comment. I understand as a new user you don't have the level of access to leave a comment on other people's questions, but this is for a reason, so it's best to sit tight, answer (or ask) questions where you can help until you have access. This answer doesn't really provide any illumination on what the user wants.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.