Complete the code to create a foreign server named 'myserver' using the 'postgres_fdw' wrapper.
CREATE SERVER [1] FOREIGN DATA WRAPPER postgres_fdw;The server name is 'myserver' as specified in the task.
Complete the code to create a user mapping for user 'localuser' to connect to 'myserver' with password 'mypassword'.
CREATE USER MAPPING FOR localuser SERVER myserver OPTIONS (user '[1]', password 'mypassword');
The user mapping must specify the remote user name that matches the local user, here 'localuser'.
Fix the error in the code to create a foreign table named 'foreign_table' that references 'remote_table' on 'myserver'.
CREATE FOREIGN TABLE foreign_table (id integer, name text) SERVER [1] OPTIONS (table_name 'remote_table');
The SERVER clause must specify the foreign server name, which is 'myserver'.
Fill both blanks to grant SELECT permission on 'foreign_table' to user 'readonly'.
GRANT [1] ON [2] TO readonly;
You grant SELECT permission on the foreign table named 'foreign_table'.
Fill all three blanks to import foreign schema 'public' from server 'myserver' into local schema 'foreign_schema'.
IMPORT FOREIGN SCHEMA [1] FROM SERVER [2] INTO [3];
The command imports the 'public' schema from 'myserver' into the local schema 'foreign_schema'.