Define a foreign table manually.
Section: Foreign Data Wrappers and Cross-DB Access
Create foreign table manually
sql
sql
CREATE FOREIGN TABLE analytics_fdw.events (
event_id bigint,
payload jsonb
)
SERVER analytics_remote
OPTIONS (schema_name 'public', table_name 'events');Explanation
See summary for usage details.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Foreign Data Wrappers and Cross-DB Access
Enable postgres_fdw
Install the built-in foreign data wrapper for PostgreSQL servers.
Create user mapping
Store remote authentication details for one local role.
Import foreign schema
Bring remote tables into a local schema automatically.