Chapter 53. Writing a Foreign Data Wrapper

Table of Contents

53.1. Foreign Data Wrapper Functions
53.2. Foreign Data Wrapper Callback Routines
53.2.1. FDW Routines for Scanning Foreign Tables
53.2.2. FDW Routines for Scanning Foreign Joins
53.2.3. FDW Routines for Planning Post-Scan/Join Processing
53.2.4. FDW Routines for Updating Foreign Tables
53.2.5. FDW Routines for Row Locking
53.2.6. FDW Routines for EXPLAIN
53.2.7. FDW Routines for ANALYZE
53.2.8. FDW Routines for IMPORT FOREIGN SCHEMA
53.2.9. FDW Routines for Parallel Execution
53.2.10. FDW Routines for Reparameterization of Paths
53.3. Foreign Data Wrapper Helper Functions
53.4. Foreign Data Wrapper Query Planning
53.5. Row Locking in Foreign Data Wrappers

All operations on a foreign table are handled through its foreign data wrapper, which consists of a set of functions that the core server calls. The foreign data wrapper is responsible for fetching data from the remote data source and returning it to the LightDB executor. If updating foreign tables is to be supported, the wrapper must handle that, too. This chapter outlines how to write a new foreign data wrapper.

The foreign data wrappers included in the standard distribution are good references when trying to write your own. Look into the contrib subdirectory of the source tree. The CREATE FOREIGN DATA WRAPPER reference page also has some useful details.

Note

The SQL standard specifies an interface for writing foreign data wrappers. However, LightDB does not implement that API, because the effort to accommodate it into LightDB would be large, and the standard API hasn't gained wide adoption anyway.

English|中文