pg_lake_spatial
pg_lake · Adds geospatial file-format and spatial-function support to pg_lake through PostGIS and GDAL-backed workflows.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2569 | pg_lake_spatial | pg_lake | 3.7 | GIS | Apache-2.0 | C |
PostgreSQL · 16, 17, 18, 19
Usage
Sources:
pg_lake_spatial connects pg_lake analytics tables to PostGIS geometry and DuckDB spatial/GDAL readers. It can infer schemas from spatial files, query remote GeoParquet or GeoJSON directly, and load supported files into regular analytics tables. It requires both pg_lake and postgis.
Core Workflow
Create the dependency chain, then define a foreign table whose columns are inferred from a remote file:
For a persisted copy, create a regular analytics table with load_from = '...' or use COPY as described by pg_lake. For GDAL-supported archives, set the documented format 'gdal' and, where needed, zip_path options.
Formats and Execution
The extension covers GeoParquet, GeoJSON/GeoJSONSeq, WKB/WKT, and formats readable through GDAL. Spatial expressions that DuckDB can execute are pushed into the analytics engine; unsupported or semantically incompatible operations fall back to PostGIS in PostgreSQL.
Caveats
GeoParquet support currently expects WKB geometry. GDAL assets may be downloaded and cached, so remote access needs working network/object-store credentials and predictable cache storage. Writing through GDAL is not supported. Analytics tables can report SRID 0; clients such as QGIS may need an explicit SRID assignment.
Spatial pushdown is incomplete. A fallback to PostGIS is correct but can add transfer and execution overhead, and joins between unlike table types can be less efficient. Verify plans and results for every important function, keep both dependencies at compatible versions, and benchmark with representative file sizes and coordinate systems.
Upstream 3.6.0
Upstream 3.6.0 adds PostgreSQL 19 support and uses DuckDB 1.5.6. Deploy matching libraries and pgduck_server, keep pg_extension_base preloaded, restart loaded processes and apply the supplied SQL updates to version 3.6. This component’s 3.5-to-3.6 SQL migration is empty; the matching runtime and its dependencies still need the coordinated release upgrade.
Upstream 3.7.0
The current reviewed release is 3.7.0 and this component’s control version is 3.7. Earlier version sections describe historical behavior and package examples. Upgrade the complete family with matching libraries and pgduck_server, restart processes holding old code, and apply the supplied extension updates to SQL version 3.7. This does not establish package availability.