ogr_fdw
ogr_fdw : foreign-data wrapper for GIS data access
Overview
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | postgis nominatim_fdw rdf_fdw pointcloud pgh_raster file_fdw |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 1.1.9 |
18 17 16 15 14 | ogr_fdw |
- |
| RPM | PGDG | 1.1.9 |
18 17 16 15 14 | ogr_fdw_$v |
- |
| DEB | PGDG | 1.1.9 |
18 17 16 15 14 | postgresql-$v-ogr-fdw |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| el8.aarch64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| el9.x86_64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| el9.aarch64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| el10.x86_64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| el10.aarch64 | PGDG 1.1.7 | PGDG 1.1.7 | PGDG 1.1.7 | PGDG 1.1.7 | PGDG 1.1.7 |
| d12.x86_64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| d12.aarch64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| d13.x86_64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| d13.aarch64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| u22.x86_64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| u22.aarch64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| u24.x86_64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| u24.aarch64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| u26.x86_64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
| u26.aarch64 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 | PGDG 1.1.9 |
Source
github.com/pramsey/pgsql-ogr-fdw
Install
Make sure PGDG repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
ogr_fdw exposes vector data supported by GDAL/OGR as PostgreSQL foreign tables. It can read files and remote data sources through OGR drivers and can write when the selected driver and data source support updates. Install PostGIS before ogr_fdw for native geometry columns; otherwise geometry is exposed as WKB bytea.
Discover and Import a Layer
Use the installed helper to inspect a source and generate matching SQL:
A minimal equivalent definition is:
The PostgreSQL server account needs filesystem permissions for file-backed data sources and network/credential access for remote drivers.
Import and Mapping
ogr_all means all OGR layers. Import normally launders table and column names; use launder_table_names and launder_column_names options when exact remote names are required. A foreign column can map to a different source name with OPTIONS (column_name 'RemoteName').
Important Options and Objects
- Server options: required
datasource, optionalformat,updateable,config_options,open_options, andcharacter_encoding. - Table options:
layeridentifies the OGR layer andupdateablecan disable writes. fididentifies a feature and is required for writable foreign tables.ogr_fdw_infolists drivers and layers and emits server/table definitions.ogr_fdw_version()reports the extension and GDAL version.ogr_fdw_drivers()lists the compiled OGR drivers.
Performance and Write Boundaries
Simple comparisons and bounding-box && predicates can be pushed down, but more complex filters may be evaluated locally. The FDW retrieves all selected source columns and opens two OGR connections per query rather than pooling them. Use EXPLAIN, project only needed columns, and benchmark the actual driver and data source.
Writes depend on driver capability and require source-level write permissions plus fid. Set updateable = false when a source must remain read-only. Version 1.1.9 simplifies the version string relative to 1.1.8 and has no documented SQL workflow change; the control file remains at SQL extension version 1.1.