ogr_fdw
ogr_fdw : foreign-data wrapper for GIS data access
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 1550 | ogr_fdw
|
ogr_fdw
|
1.1.9 |
GIS
|
MIT
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r
|
No
|
Yes
|
No
|
Yes
|
yes
|
no
|
| Relationships | |
|---|---|
| See Also | postgis
file_fdw
postgres_fdw
postgis_topology
postgis_raster
postgis_sfcgal
postgis_tiger_geocoder
address_standardizer
|
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
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install ogr_fdw; # install via package name, for the active PG version
pig install ogr_fdw -v 18; # install for PG 18
pig install ogr_fdw -v 17; # install for PG 17
pig install ogr_fdw -v 16; # install for PG 16
pig install ogr_fdw -v 15; # install for PG 15
pig install ogr_fdw -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION ogr_fdw;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:
ogr_fdw_info -s /srv/gis/cities.gpkg
ogr_fdw_info -s /srv/gis/cities.gpkg -l cities
A minimal equivalent definition is:
CREATE EXTENSION postgis;
CREATE EXTENSION ogr_fdw;
CREATE SERVER city_source
FOREIGN DATA WRAPPER ogr_fdw
OPTIONS (
datasource '/srv/gis/cities.gpkg',
format 'GPKG'
);
CREATE FOREIGN TABLE city (
fid bigint,
geom geometry,
name text
) SERVER city_source
OPTIONS (layer 'cities');
SELECT fid, name FROM city WHERE geom && ST_MakeEnvelope(-10, 35, 30, 60, 4326);The PostgreSQL server account needs filesystem permissions for file-backed data sources and network/credential access for remote drivers.
Import and Mapping
CREATE SCHEMA gis_import;
IMPORT FOREIGN SCHEMA ogr_all
LIMIT TO (cities)
FROM SERVER city_source
INTO gis_import;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.