OGR FDW Update
29 Apr 2016I’ve had a productive couple of weeks here, despite the intermittently lovely weather and the beginning of Little League baseball season (not coaching, just supporting my pitcher-in-training).
The focus of my energies has been a long-awaited (by me) update to the OGR FDW extension for PostgreSQL. By binding the multi-format OGR library into PostgreSQL, we get access to the many formats supported by OGR, all with just one piece of extension code.
As usual, the hardest part of the coding was remembering how things worked in the first place! But after getting my head back in the game the new code flowed out and now I can reveal the new improved OGR FDW!
The new features are:
- Column name mapping between OGR layers and PgSQL tables is now completely configurable. The extension will attempt to guess mapping automagically, using names and type consistency, but you can over-ride mappings using the table-level
column_name
option. -
Foreign tables are now updateable! That means, for OGR sources that support it, you can run
INSERT
,UPDATE
andDELETE
commands on your OGR FDW tables and the changes will be applied to the source.- You can control which tables and foreign servers are updateable by setting the
UPDATEABLE
option on the foreign server and foreign table definitions.
- You can control which tables and foreign servers are updateable by setting the
- PostgreSQL 9.6 is supported. It’s not released yet, but we can now build against it.
- Geometry type and spatial reference system are propogated from OGR. If your OGR source defines a geometry type and spatial reference identifier, the FDW tables in PostGIS will now reflect that, for easier integration with your local geometry data.
- GDAL2 and GDAL1 are supported. Use of GDAL2 syntax has been made the default in the code-base, with mappings back to GDAL1 for compatibility, so the code is now future-ready.
- Regression tests and continuous integration are in place, for improved code reliability. Thanks to help from Even Roualt, we are now using Travis-CI for integration testing, and I’ve enabled a growing number of integration tests.
As usual, I’m in debt to Regina Obe for her timely feedback and willingness to torture-test very fresh code.
For now, early adopters can get the code by cloning and building the project master branch, but I will be releasing a numbered version in a week or two when any obvious bugs have been shaken out.