From 94ecf5dd255bdd112c9acb0603834152b2941d29 Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 12:39:02 +0100 Subject: [PATCH 01/11] Add details to FDW page and relocate to Ingestion. --- docs/feature/fdw/index.md | 83 --------------------- docs/feature/index.md | 2 +- docs/ingest/fdw.md | 147 ++++++++++++++++++++++++++++++++++++++ docs/ingest/index.md | 1 + 4 files changed, 149 insertions(+), 84 deletions(-) delete mode 100644 docs/feature/fdw/index.md create mode 100644 docs/ingest/fdw.md diff --git a/docs/feature/fdw/index.md b/docs/feature/fdw/index.md deleted file mode 100644 index 3dcb59760..000000000 --- a/docs/feature/fdw/index.md +++ /dev/null @@ -1,83 +0,0 @@ -(fdw)= -# Foreign Data Wrapper - -:::{include} /_include/links.md -::: - -:::::{grid} -:padding: 0 - -::::{grid-item} -:class: rubric-slim -:columns: auto 9 9 9 - -:::{rubric} Overview -::: -In the spirit of the PostgreSQL FDW implementation, CrateDB offers the -possibility to access database tables on remote database servers as if -they would be stored within CrateDB. - -:::{rubric} About -::: -Foreign Data Wrappers allow you to make data in -foreign systems available as tables within CrateDB. You can then query -these foreign tables like regular user tables. - -:::: - -::::{grid-item} -:class: rubric-slim -:columns: auto 3 3 3 - -:::{rubric} Reference Manual -::: -- {ref}`crate-reference:administration-fdw` -:::{rubric} SQL Functions -::: -- {ref}`crate-reference:ref-create-server` -- {ref}`crate-reference:ref-drop-server` -- {ref}`crate-reference:ref-create-foreign-table` -- {ref}`crate-reference:ref-drop-foreign-table` -:::{rubric} System Tables -::: -- {ref}`crate-reference:foreign_servers` -- {ref}`crate-reference:foreign_server_options` -- {ref}`crate-reference:foreign_tables` -- {ref}`crate-reference:foreign_table_options` -- {ref}`crate-reference:user_mappings` -- {ref}`crate-reference:user_mapping_options` - -{tags-primary}`SQL` -{tags-primary}`FDW` -:::: - -::::: - - -## Synopsis -Connect to a remote PostgreSQL server. -```sql -CREATE SERVER my_postgresql -FOREIGN DATA WRAPPER jdbc -OPTIONS (url 'jdbc:postgresql://example.com:5432/') -``` -Mount a database table. -```sql -CREATE FOREIGN TABLE doc.remote_documents (name text) -SERVER my_postgresql -OPTIONS (schema_name 'public', table_name 'documents'); -``` - - -:::{note} -{material-outlined}`construction;2em` This page is currently under construction. -It includes not even the most basic essentials, and needs expansion. For example, -the "Details", "Usage" and "Learn" sections are missing completely. -::: - - - -:::{seealso} -**Product:** -[Relational Database] -::: diff --git a/docs/feature/index.md b/docs/feature/index.md index 03e0c4060..1dc3ddfa4 100644 --- a/docs/feature/index.md +++ b/docs/feature/index.md @@ -54,7 +54,7 @@ architecture, inherited from Elasticsearch. query/index generated/index cursor/index -fdw/index +../ingest/fdw udf/index ccr/index ::: diff --git a/docs/ingest/fdw.md b/docs/ingest/fdw.md new file mode 100644 index 000000000..1866eb03e --- /dev/null +++ b/docs/ingest/fdw.md @@ -0,0 +1,147 @@ +(fdw)= + +# Foreign data wrappers + +:::{div} sd-text-muted +Access PostgreSQL database tables on remote servers as if they were stored +within CrateDB. +::: + +## Limitations + +- **Read-only** – only SELECT (DQL) is supported on foreign tables. +- **PostgreSQL support** – currently CrateDB only supports FDW for PostgreSQL. +- **Filter push-down is best-effort** – use `EXPLAIN` to see what is pushed. +- **Security guard-rail** – by default only the `crate` user may connect to + *localhost* targets. Override via `fdw.allow_local = true` if you must. + +## Prerequisites + +Before configuring a Foreign Data Wrapper (FDW), you should have CrateDB and +PostgreSQL instances up and running. + +:::{note} +To have access to FDW in CrateDB, make sure you have a cluster running +version 5.7 or above. +::: + +## Set up + +Ensure outbound firewall rules allow CrateDB → remote DB traffic before +proceeding with the following steps. + +::::{stepper} +### Create a server in CrateDB + +```sql +CREATE SERVER my_postgresql FOREIGN DATA WRAPPER jdbc +OPTIONS (url 'jdbc:postgresql://example.com:5432/'); +``` + +:::{note} +By default only the `crate` user can use server definitions that connect to +localhost. Other users are not allowed to connect to instances running on the +same host as CrateDB. This is a security measure to prevent users from +bypassing [Host-Based Authentication (HBA)] restrictions. +See [fdw.allow_local]. + +[Host-Based Authentication (HBA)]: inv:crate-reference:*:label#admin_hba +[fdw.allow_local]: inv:crate-reference:*:label#fdw.allow_local +::: + +### Create a user mapping + +This step is a DDL statement that maps a CrateDB user to another user on a +foreign server. If not set, your session details will be used instead. + +```sql +CREATE USER MAPPING +FOR mylocaluser +SERVER my_postgresql +OPTIONS ("user" 'myremoteuser', password '*****'); +``` + +### Create foreign tables + +Establish a view onto data in the foreign system: + +```sql +CREATE FOREIGN TABLE doc.remote_readings ( + ts timestamp, + device text, + value double +) SERVER my_postgresql + OPTIONS ( + schema_name 'public', -- remote schema + table_name 'readings' + ); +``` + +:::: + +## Usage + +### Query and debug + +You can query these foreign tables like regular user tables: + +```sql +SELECT ts, value +FROM remote_readings +WHERE device = 'sensor-42'; +``` + +Query clauses like `GROUP BY`, `HAVING`, `LIMIT` or `ORDER BY` are executed +within CrateDB, not within the foreign system. `WHERE` clauses can in some +circumstances be pushed to the foreign system, but that depends on the +concrete foreign data wrapper implementation. You can check if this is the +case by using the {ref}`crate-reference:ref-explain` statement. + +For example, in the following explain output there is a dedicated `Filter` +node, indicating that the filter is executed within CrateDB: + +```sql +EXPLAIN SELECT ts, value FROM remote_readings WHERE device = 'sensor-42'; +``` + +```text ++--------------------------------------------------------------------------+ +| QUERY PLAN | ++--------------------------------------------------------------------------+ +| Filter[(device = 'sensor-42')] (rows=0) | +| └ ForeignCollect[doc.remote_readings | [device] | true] (rows=unknown) | ++--------------------------------------------------------------------------+ +``` + +### Drop server + +```sql +DROP SERVER my_postgresql; +``` + +You can drop the server once it is no longer used. The clauses available are: + +- **IF EXISTS** – the statement won't raise an error if any servers listed + don't exist. +- **RESTRICT** – raises an error if any foreign table or user mappings for the + given servers exist. This is the default. +- **CASCADE** – causes `DROP SERVER` to also delete all foreign tables and + mapped users using the given servers. + +:::{seealso} +{ref}`Reference manual ` + +**SQL Functions:** +- {ref}`crate-reference:ref-create-server` +- {ref}`crate-reference:ref-drop-server` +- {ref}`crate-reference:ref-create-foreign-table` +- {ref}`crate-reference:ref-drop-foreign-table` + +**System Tables:** +- {ref}`crate-reference:foreign_servers` +- {ref}`crate-reference:foreign_server_options` +- {ref}`crate-reference:foreign_tables` +- {ref}`crate-reference:foreign_table_options` +- {ref}`crate-reference:user_mappings` +- {ref}`crate-reference:user_mapping_options` +::: diff --git a/docs/ingest/index.md b/docs/ingest/index.md index c1580903a..5e4e39fc6 100644 --- a/docs/ingest/index.md +++ b/docs/ingest/index.md @@ -11,6 +11,7 @@ Data ingestion / loading / import methods for CrateDB at a glance. :maxdepth: 2 :hidden: +fdw etl/index cdc/index telemetry/index From bc212a59d557bf5338995a2d6d07fa3003d2e1ef Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 13:22:36 +0100 Subject: [PATCH 02/11] Fix TOC where fdw was still in "All features" --- docs/feature/index.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/feature/index.md b/docs/feature/index.md index 1dc3ddfa4..5692e8753 100644 --- a/docs/feature/index.md +++ b/docs/feature/index.md @@ -50,14 +50,21 @@ architecture, inherited from Elasticsearch. ::::{grid-item-card} {material-outlined}`read_more;2em` Advanced :::{toctree} :maxdepth: 1 +:hidden: query/index generated/index cursor/index -../ingest/fdw udf/index ccr/index ::: + +- {doc}`query/index` +- {doc}`generated/index` +- {doc}`cursor/index` +- {ref}`Foreign data wrappers ` +- {doc}`udf/index` +- {doc}`ccr/index` +++ Advanced features supporting daily data operations, all based on standard SQL. From cb133e23aa1f247957ac7445bac94c0752129bf8 Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 14:18:06 +0100 Subject: [PATCH 03/11] Reverted the move --- docs/{ingest/fdw.md => feature/fdw/index.md} | 0 docs/feature/index.md | 9 +-------- docs/ingest/index.md | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) rename docs/{ingest/fdw.md => feature/fdw/index.md} (100%) diff --git a/docs/ingest/fdw.md b/docs/feature/fdw/index.md similarity index 100% rename from docs/ingest/fdw.md rename to docs/feature/fdw/index.md diff --git a/docs/feature/index.md b/docs/feature/index.md index 5692e8753..03e0c4060 100644 --- a/docs/feature/index.md +++ b/docs/feature/index.md @@ -50,21 +50,14 @@ architecture, inherited from Elasticsearch. ::::{grid-item-card} {material-outlined}`read_more;2em` Advanced :::{toctree} :maxdepth: 1 -:hidden: query/index generated/index cursor/index +fdw/index udf/index ccr/index ::: - -- {doc}`query/index` -- {doc}`generated/index` -- {doc}`cursor/index` -- {ref}`Foreign data wrappers ` -- {doc}`udf/index` -- {doc}`ccr/index` +++ Advanced features supporting daily data operations, all based on standard SQL. diff --git a/docs/ingest/index.md b/docs/ingest/index.md index 5e4e39fc6..c1580903a 100644 --- a/docs/ingest/index.md +++ b/docs/ingest/index.md @@ -11,7 +11,6 @@ Data ingestion / loading / import methods for CrateDB at a glance. :maxdepth: 2 :hidden: -fdw etl/index cdc/index telemetry/index From b30e4f3a29d0a84638b510a874136920dbbf2252 Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 12:39:02 +0100 Subject: [PATCH 04/11] Add details to FDW page and relocate to Ingestion. --- docs/feature/fdw/index.md | 83 --------------------- docs/feature/index.md | 2 +- docs/ingest/fdw.md | 147 ++++++++++++++++++++++++++++++++++++++ docs/ingest/index.md | 1 + 4 files changed, 149 insertions(+), 84 deletions(-) delete mode 100644 docs/feature/fdw/index.md create mode 100644 docs/ingest/fdw.md diff --git a/docs/feature/fdw/index.md b/docs/feature/fdw/index.md deleted file mode 100644 index 3dcb59760..000000000 --- a/docs/feature/fdw/index.md +++ /dev/null @@ -1,83 +0,0 @@ -(fdw)= -# Foreign Data Wrapper - -:::{include} /_include/links.md -::: - -:::::{grid} -:padding: 0 - -::::{grid-item} -:class: rubric-slim -:columns: auto 9 9 9 - -:::{rubric} Overview -::: -In the spirit of the PostgreSQL FDW implementation, CrateDB offers the -possibility to access database tables on remote database servers as if -they would be stored within CrateDB. - -:::{rubric} About -::: -Foreign Data Wrappers allow you to make data in -foreign systems available as tables within CrateDB. You can then query -these foreign tables like regular user tables. - -:::: - -::::{grid-item} -:class: rubric-slim -:columns: auto 3 3 3 - -:::{rubric} Reference Manual -::: -- {ref}`crate-reference:administration-fdw` -:::{rubric} SQL Functions -::: -- {ref}`crate-reference:ref-create-server` -- {ref}`crate-reference:ref-drop-server` -- {ref}`crate-reference:ref-create-foreign-table` -- {ref}`crate-reference:ref-drop-foreign-table` -:::{rubric} System Tables -::: -- {ref}`crate-reference:foreign_servers` -- {ref}`crate-reference:foreign_server_options` -- {ref}`crate-reference:foreign_tables` -- {ref}`crate-reference:foreign_table_options` -- {ref}`crate-reference:user_mappings` -- {ref}`crate-reference:user_mapping_options` - -{tags-primary}`SQL` -{tags-primary}`FDW` -:::: - -::::: - - -## Synopsis -Connect to a remote PostgreSQL server. -```sql -CREATE SERVER my_postgresql -FOREIGN DATA WRAPPER jdbc -OPTIONS (url 'jdbc:postgresql://example.com:5432/') -``` -Mount a database table. -```sql -CREATE FOREIGN TABLE doc.remote_documents (name text) -SERVER my_postgresql -OPTIONS (schema_name 'public', table_name 'documents'); -``` - - -:::{note} -{material-outlined}`construction;2em` This page is currently under construction. -It includes not even the most basic essentials, and needs expansion. For example, -the "Details", "Usage" and "Learn" sections are missing completely. -::: - - - -:::{seealso} -**Product:** -[Relational Database] -::: diff --git a/docs/feature/index.md b/docs/feature/index.md index 03e0c4060..1dc3ddfa4 100644 --- a/docs/feature/index.md +++ b/docs/feature/index.md @@ -54,7 +54,7 @@ architecture, inherited from Elasticsearch. query/index generated/index cursor/index -fdw/index +../ingest/fdw udf/index ccr/index ::: diff --git a/docs/ingest/fdw.md b/docs/ingest/fdw.md new file mode 100644 index 000000000..1866eb03e --- /dev/null +++ b/docs/ingest/fdw.md @@ -0,0 +1,147 @@ +(fdw)= + +# Foreign data wrappers + +:::{div} sd-text-muted +Access PostgreSQL database tables on remote servers as if they were stored +within CrateDB. +::: + +## Limitations + +- **Read-only** – only SELECT (DQL) is supported on foreign tables. +- **PostgreSQL support** – currently CrateDB only supports FDW for PostgreSQL. +- **Filter push-down is best-effort** – use `EXPLAIN` to see what is pushed. +- **Security guard-rail** – by default only the `crate` user may connect to + *localhost* targets. Override via `fdw.allow_local = true` if you must. + +## Prerequisites + +Before configuring a Foreign Data Wrapper (FDW), you should have CrateDB and +PostgreSQL instances up and running. + +:::{note} +To have access to FDW in CrateDB, make sure you have a cluster running +version 5.7 or above. +::: + +## Set up + +Ensure outbound firewall rules allow CrateDB → remote DB traffic before +proceeding with the following steps. + +::::{stepper} +### Create a server in CrateDB + +```sql +CREATE SERVER my_postgresql FOREIGN DATA WRAPPER jdbc +OPTIONS (url 'jdbc:postgresql://example.com:5432/'); +``` + +:::{note} +By default only the `crate` user can use server definitions that connect to +localhost. Other users are not allowed to connect to instances running on the +same host as CrateDB. This is a security measure to prevent users from +bypassing [Host-Based Authentication (HBA)] restrictions. +See [fdw.allow_local]. + +[Host-Based Authentication (HBA)]: inv:crate-reference:*:label#admin_hba +[fdw.allow_local]: inv:crate-reference:*:label#fdw.allow_local +::: + +### Create a user mapping + +This step is a DDL statement that maps a CrateDB user to another user on a +foreign server. If not set, your session details will be used instead. + +```sql +CREATE USER MAPPING +FOR mylocaluser +SERVER my_postgresql +OPTIONS ("user" 'myremoteuser', password '*****'); +``` + +### Create foreign tables + +Establish a view onto data in the foreign system: + +```sql +CREATE FOREIGN TABLE doc.remote_readings ( + ts timestamp, + device text, + value double +) SERVER my_postgresql + OPTIONS ( + schema_name 'public', -- remote schema + table_name 'readings' + ); +``` + +:::: + +## Usage + +### Query and debug + +You can query these foreign tables like regular user tables: + +```sql +SELECT ts, value +FROM remote_readings +WHERE device = 'sensor-42'; +``` + +Query clauses like `GROUP BY`, `HAVING`, `LIMIT` or `ORDER BY` are executed +within CrateDB, not within the foreign system. `WHERE` clauses can in some +circumstances be pushed to the foreign system, but that depends on the +concrete foreign data wrapper implementation. You can check if this is the +case by using the {ref}`crate-reference:ref-explain` statement. + +For example, in the following explain output there is a dedicated `Filter` +node, indicating that the filter is executed within CrateDB: + +```sql +EXPLAIN SELECT ts, value FROM remote_readings WHERE device = 'sensor-42'; +``` + +```text ++--------------------------------------------------------------------------+ +| QUERY PLAN | ++--------------------------------------------------------------------------+ +| Filter[(device = 'sensor-42')] (rows=0) | +| └ ForeignCollect[doc.remote_readings | [device] | true] (rows=unknown) | ++--------------------------------------------------------------------------+ +``` + +### Drop server + +```sql +DROP SERVER my_postgresql; +``` + +You can drop the server once it is no longer used. The clauses available are: + +- **IF EXISTS** – the statement won't raise an error if any servers listed + don't exist. +- **RESTRICT** – raises an error if any foreign table or user mappings for the + given servers exist. This is the default. +- **CASCADE** – causes `DROP SERVER` to also delete all foreign tables and + mapped users using the given servers. + +:::{seealso} +{ref}`Reference manual ` + +**SQL Functions:** +- {ref}`crate-reference:ref-create-server` +- {ref}`crate-reference:ref-drop-server` +- {ref}`crate-reference:ref-create-foreign-table` +- {ref}`crate-reference:ref-drop-foreign-table` + +**System Tables:** +- {ref}`crate-reference:foreign_servers` +- {ref}`crate-reference:foreign_server_options` +- {ref}`crate-reference:foreign_tables` +- {ref}`crate-reference:foreign_table_options` +- {ref}`crate-reference:user_mappings` +- {ref}`crate-reference:user_mapping_options` +::: diff --git a/docs/ingest/index.md b/docs/ingest/index.md index c1580903a..5e4e39fc6 100644 --- a/docs/ingest/index.md +++ b/docs/ingest/index.md @@ -11,6 +11,7 @@ Data ingestion / loading / import methods for CrateDB at a glance. :maxdepth: 2 :hidden: +fdw etl/index cdc/index telemetry/index From 6b3d0b6bc37997241f826c6e1ca2f7114981d6c8 Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 13:22:36 +0100 Subject: [PATCH 05/11] Fix TOC where fdw was still in "All features" --- docs/feature/index.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/feature/index.md b/docs/feature/index.md index 1dc3ddfa4..5692e8753 100644 --- a/docs/feature/index.md +++ b/docs/feature/index.md @@ -50,14 +50,21 @@ architecture, inherited from Elasticsearch. ::::{grid-item-card} {material-outlined}`read_more;2em` Advanced :::{toctree} :maxdepth: 1 +:hidden: query/index generated/index cursor/index -../ingest/fdw udf/index ccr/index ::: + +- {doc}`query/index` +- {doc}`generated/index` +- {doc}`cursor/index` +- {ref}`Foreign data wrappers ` +- {doc}`udf/index` +- {doc}`ccr/index` +++ Advanced features supporting daily data operations, all based on standard SQL. From c2359fb813d647e2900351d5b184920896e2d2da Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 14:18:06 +0100 Subject: [PATCH 06/11] Reverted the move --- docs/{ingest/fdw.md => feature/fdw/index.md} | 0 docs/feature/index.md | 9 +-------- docs/ingest/index.md | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) rename docs/{ingest/fdw.md => feature/fdw/index.md} (100%) diff --git a/docs/ingest/fdw.md b/docs/feature/fdw/index.md similarity index 100% rename from docs/ingest/fdw.md rename to docs/feature/fdw/index.md diff --git a/docs/feature/index.md b/docs/feature/index.md index 5692e8753..03e0c4060 100644 --- a/docs/feature/index.md +++ b/docs/feature/index.md @@ -50,21 +50,14 @@ architecture, inherited from Elasticsearch. ::::{grid-item-card} {material-outlined}`read_more;2em` Advanced :::{toctree} :maxdepth: 1 -:hidden: query/index generated/index cursor/index +fdw/index udf/index ccr/index ::: - -- {doc}`query/index` -- {doc}`generated/index` -- {doc}`cursor/index` -- {ref}`Foreign data wrappers ` -- {doc}`udf/index` -- {doc}`ccr/index` +++ Advanced features supporting daily data operations, all based on standard SQL. diff --git a/docs/ingest/index.md b/docs/ingest/index.md index 5e4e39fc6..c1580903a 100644 --- a/docs/ingest/index.md +++ b/docs/ingest/index.md @@ -11,7 +11,6 @@ Data ingestion / loading / import methods for CrateDB at a glance. :maxdepth: 2 :hidden: -fdw etl/index cdc/index telemetry/index From 79f23072d9b443e959cf782ce0c8db7ada2e3268 Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 15:17:04 +0100 Subject: [PATCH 07/11] Apply suggestion from @bmunkholm --- docs/feature/fdw/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature/fdw/index.md b/docs/feature/fdw/index.md index 1866eb03e..f70de6bed 100644 --- a/docs/feature/fdw/index.md +++ b/docs/feature/fdw/index.md @@ -66,7 +66,7 @@ OPTIONS ("user" 'myremoteuser', password '*****'); Establish a view onto data in the foreign system: ```sql -CREATE FOREIGN TABLE doc.remote_readings ( +CREATE FOREIGN TABLE remote_readings ( ts timestamp, device text, value double From 05e62097238a97705d1c0b7d0caad59a725b7773 Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 15:56:57 +0100 Subject: [PATCH 08/11] suggestion fix Co-authored-by: Andreas Motl --- docs/feature/fdw/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature/fdw/index.md b/docs/feature/fdw/index.md index f70de6bed..46c99197e 100644 --- a/docs/feature/fdw/index.md +++ b/docs/feature/fdw/index.md @@ -18,7 +18,7 @@ within CrateDB. ## Prerequisites Before configuring a Foreign Data Wrapper (FDW), you should have CrateDB and -PostgreSQL instances up and running. +PostgreSQL instances up and running, or other services that speak the PostgreSQL wire protocol. :::{note} To have access to FDW in CrateDB, make sure you have a cluster running From d1060c9096d65e1bc59730884a87c3849cfc0b86 Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 15:57:38 +0100 Subject: [PATCH 09/11] feedback Co-authored-by: Andreas Motl --- docs/feature/fdw/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature/fdw/index.md b/docs/feature/fdw/index.md index 46c99197e..f1db12441 100644 --- a/docs/feature/fdw/index.md +++ b/docs/feature/fdw/index.md @@ -51,7 +51,7 @@ See [fdw.allow_local]. ### Create a user mapping -This step is a DDL statement that maps a CrateDB user to another user on a +Use a DDL statement to map a CrateDB user to another user on a foreign server. If not set, your session details will be used instead. ```sql From 210a38a4701671e9ea7bcd6ae0a69d5a0cd00972 Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 15:59:30 +0100 Subject: [PATCH 10/11] Update docs/feature/fdw/index.md Co-authored-by: Andreas Motl --- docs/feature/fdw/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature/fdw/index.md b/docs/feature/fdw/index.md index f1db12441..64458b317 100644 --- a/docs/feature/fdw/index.md +++ b/docs/feature/fdw/index.md @@ -61,7 +61,7 @@ SERVER my_postgresql OPTIONS ("user" 'myremoteuser', password '*****'); ``` -### Create foreign tables +### Create foreign table Establish a view onto data in the foreign system: From f90aa90821fc1bde5c54c7a2b551c244ff03c86d Mon Sep 17 00:00:00 2001 From: Brian Munkholm Date: Thu, 12 Feb 2026 17:20:40 +0100 Subject: [PATCH 11/11] feedback --- docs/feature/fdw/index.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/feature/fdw/index.md b/docs/feature/fdw/index.md index 64458b317..eb230750d 100644 --- a/docs/feature/fdw/index.md +++ b/docs/feature/fdw/index.md @@ -4,16 +4,11 @@ :::{div} sd-text-muted Access PostgreSQL database tables on remote servers as if they were stored -within CrateDB. +within CrateDB and perform read-only queries on the data. ::: -## Limitations -- **Read-only** – only SELECT (DQL) is supported on foreign tables. -- **PostgreSQL support** – currently CrateDB only supports FDW for PostgreSQL. -- **Filter push-down is best-effort** – use `EXPLAIN` to see what is pushed. -- **Security guard-rail** – by default only the `crate` user may connect to - *localhost* targets. Override via `fdw.allow_local = true` if you must. +This guide walks you through setting up and querying foreign data wrappers. ## Prerequisites @@ -27,10 +22,13 @@ version 5.7 or above. ## Set up +::::{stepper} + +### Set firewall rules + Ensure outbound firewall rules allow CrateDB → remote DB traffic before proceeding with the following steps. -::::{stepper} ### Create a server in CrateDB ```sql @@ -128,6 +126,18 @@ You can drop the server once it is no longer used. The clauses available are: - **CASCADE** – causes `DROP SERVER` to also delete all foreign tables and mapped users using the given servers. +## Example + +:::{card} +:link: https://github.com/crate/cratedb-examples/tree/main/application/roapi +:link-type: url +{material-regular}`play_arrow;2em` +Integrating ROAPI data sources with CrateDB. ++++ +Demonstrates how to mount ROAPI data sources as tables in CrateDB +using the PostgreSQL foreign data wrapper. +::: + :::{seealso} {ref}`Reference manual `