Skip to content
Back to skills

Postgis Knowledge Patch

ASecurity

PostGIS

  • 25 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 27, 2026
data-aigosqlnodedebuggingdatabase

Works with

  • cli

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill postgis-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Postgis Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Postgis Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-postgis-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-postgis-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: postgis-knowledge-patch
description: PostGIS
version: "3.7.0"
license: MIT
metadata:
  author: Nevaberry
---


# PostGIS compatibility and workflow guidance

Load this skill when upgrading PostGIS extensions, adapting geometry or raster
SQL, working with topology, or using the loaders and TIGER geocoder.
The references contain full behavior details, version attributions, and examples.

> [!CAUTION]
> Guidance marked `3.7.0alpha1` describes a prerelease and may change before stable release.

## Reference index

| Reference | Topics |
| --- | --- |
| [Compatibility and upgrades](references/compatibility-and-upgrades.md) | Extension upgrades, runtime and feature dependencies, builds, metadata, maintenance |
| [Geometry and processing](references/geometry-and-processing.md) | Predicates, coverages, rendering, curves, surfaces, measures, output formats, SFCGAL |
| [Loaders, CLI, and TIGER](references/loaders-cli-and-tiger.md) | Database commands, shapefile and raster loaders, geocoder installation, addresses |
| [Raster and GDAL](references/raster-and-gdal.md) | Clipping, rasterization, remapping, sampling, map algebra, polygonization, logging |
| [Topology](references/topology.md) | Signatures, column repair, loading, tolerance, precision, import, storage, diagnostics |

## Upgrade and compatibility changes

### Upgrade extension SQL after installing binaries

When upgrading to PostGIS 3.5.0, after installing the new binaries or running
`pg_upgrade`, call `postgis_extensions_upgrade()` once for PostGIS 3.0–3.4.
For PostGIS 2.5 and earlier, use this sequence in each affected database:

```sql
ALTER EXTENSION postgis UPDATE;
SELECT postgis_extensions_upgrade();
SELECT postgis_extensions_upgrade();
```

### Rebuild objects affected by changed signatures

- Rebuild views and materialized views using the record overload of `ST_AsGeoJSON`
  when upgrading to its new signature. It can promote a column to the feature's
  top-level `id` with `id_column`.
- All raster `ST_Clip` overloads were replaced; rebuild materialized views that
  call any of them. `touched => true` includes pixels touched by the clip geometry.
- Many `postgis_topology` identifier parameters now declare `bigint` and accept
  both `integer` and `bigint`. Update references using the old exact signatures.
- `ST_ApproxQuantile(raster, double precision)` was removed because it caused
  ambiguous calls. Check SQL that refers to that exact signature.

### Repair topology columns after the affected upgrade

The 3.6.0 topology upgrade can corrupt existing `TopoGeometry` columns. After
upgrading `postgis_topology` to 3.6.1, run the repair for registered layers:

```sql
SELECT topology.FixCorruptTopoGeometryColumn(schema_name, table_name, feature_column)
FROM topology.layer;
```

### Deprecations and removed interfaces

Functions provided by `postgis_sfcgal` now use the `CG_` prefix; their old `ST_`
names are deprecated. Use `CG_StraightSkeleton` in place of `ST_StraightSkeleton`.
The optional `WFS_locks` package was removed. Geometry and geography typmod bit
helpers are no longer available from the public `liblwgeom` header to C code.

### Replace the removed collection aggregate

> **Prerelease (`3.7.0alpha1`):** This guidance may change before stable release.

`ST_MemCollect` was removed. Use the `ST_Collect(geom)` aggregate.

### Adapt alpha-shape result expectations

> **Prerelease (`3.7.0alpha1`):** This guidance may change before stable release.

`CG_AlphaShape` now returns a `MultiPolygon`. Update callers expecting a `Polygon`,
including columns with a polygon-only typmod.

### Geometry metadata and surface access

In 3.6.0, `geometry_columns` stopped deriving metadata from table constraints.
Use a geometry typmod such as `geometry(Point, 4326)` to expose type and SRID in
that view on 3.6.0. PostGIS 3.6.1 restored constraint parsing.
`ST_NumGeometries` and `ST_GeometryN` now treat TINs and polyhedral surfaces as
single geometries. Use `ST_NumPatches` to count faces and `ST_PatchN` to extract one.

### Changed comparison and measurement results

- The explicit geometry inequality operator resolves ambiguity for `<>` or `!=`.
  For two `TopoGeometry` values, `<>` is now ambiguous; use fieldwise comparisons
  of `id`, `topology_id`, `layer_id`, and `type` as shown in the geometry reference.
- `ST_GeneratePoints` can return a different point set for the same seed.
  Regenerate stored point sets or test fixtures that need to match the 3.5.0 output.
- `ST_DFullyWithin(A, B, R)` now follows `ST_Contains(ST_Buffer(A, R), B)`.
- `ST_Length` now returns zero for a `CurvePolygon`.
- With GEOS 3.13's RelateNG, zero-length `LineString` values are treated as points;
  the multi-valent endpoint boundary-node rule can produce different relate matrices.
  Matrices can also change for invalid `MultiPolygon` inputs with shared boundaries;
  apply `ST_MakeValid` before relating those inputs.

## Standalone extensions and database commands

### Install and upgrade the TIGER geocoder

`postgis_tiger_geocoder` 2025.1 requires PostgreSQL 16 or later and is expected to
work with any supported PostGIS version. PostGIS 3.6 is the last series to bundle
it, so install it separately with PostGIS 3.7.
Start with `ALTER EXTENSION postgis_tiger_geocoder UPDATE`. If PostgreSQL reports
no update path to 2025.1, or if upgrading from a development version, use:

```sql
ALTER EXTENSION postgis_tiger_geocoder UPDATE TO "ANY";
ALTER EXTENSION postgis_tiger_geocoder UPDATE;
```

The extension no longer adds `tiger` to the database search path. Add `tiger` to
the applicable `search_path` for unqualified calls, or use qualified names such
as `tiger.normalize_address(...)`.

### Install the address standardizer separately

> **Prerelease (`3.7.0alpha1`):** This guidance may change before stable release.

Install `address_standardizer` separately when moving to PostGIS 3.7.

### Work across databases

`postgis list-enabled` lists databases with PostGIS; `postgis list-all` lists all
databases. `postgis status` reports across all databases, and `postgis upgrade`
upgrades every database that needs it.

## Geometry processing quick reference

### Clean polygon coverages

`ST_CoverageClean` resolves polygon overlaps, closes small gaps, and aligns shared
edges. It requires GEOS 3.14 or later. Use `OVER ()` for one coverage or partition
the window by coverage ID. `gapMaximumWidth` defaults to `0` and closes gaps
narrower than the supplied width. `snappingDistance` defaults to `-1` for automatic
vertex snapping; `0` disables snapping.
The default `MERGE_LONGEST_BORDER` assigns overlap to the neighbor with the longest
common border. Alternatives are `MERGE_MAX_AREA`, `MERGE_MIN_AREA`, and
`MERGE_MIN_INDEX` for the largest area, smallest area, and smallest input index.

### Reduce geometry for rendering

`ST_RemoveIrrelevantPointsForView(geom, bounds, cartesian_hint)` takes `box2d`
bounds and removes vertices while preserving rendering inside the rectangle.
`cartesian_hint` defaults to `false`; `true` can remove more vertices, but projecting
the result before rendering can introduce artifacts. Polygon results can
self-intersect. Use `ST_IsValid` to check them and `ST_MakeValid` if they need repair.
`ST_RemoveSmallParts(geom, minSizeX, minSizeY)` removes a polygon ring or line string
when either dimension is strictly below its positive threshold in coordinate units.
A zero or negative threshold disables that dimension's test. Removing an exterior
ring drops its polygon; removing all parts can yield an empty geometry.
`ST_TileEnvelope` clips its result to the tile plane extent, including positive
margins on tiles at the edge of the plane.

### Read measures and coordinate spans

`ST_MMin` and `ST_MMax` read a geometry's minimum and maximum M values.
`ST_XSize`, `ST_YSize`, `ST_ZSize`, and `ST_MSize` return the corresponding ordinate's span.

## Topology and raster quick reference

### Use topology precision when inserting lines

> **Prerelease (`3.7.0alpha1`):** This guidance may change before stable release.

Topology-building functions now default to `-1` to use the topology's precision.
An explicit tolerance of `0` means zero tolerance. `TopoGeo_AddLinestring` accepts
`max_edges` to limit the number of edges. The topology reference contains an example
and its existing-topology and SRID requirements.

### Load and inspect topology

`TopoGeo_LoadGeometry` loads geometry into an existing topology.
`ValidateTopologyPrecision` checks coordinate precision; `MakeTopologyPrecise`
adjusts it. `TotalTopologySize` returns a topology's total storage size.
`pgtopo_import --drop-topology` drops an existing target topology before importing
its replacement.

### Rasterize and remap values

`ST_AsRasterAgg` rasterizes a set of geometries into one raster.
`ST_ReclassExact` maps individual raster pixel values to new values.
`ST_IntersectionFractions` computes the fraction of each raster cell covered by
the intersecting geometry and requires GEOS 3.14 or later.
`ST_AsRaster` accepts curved geometry inputs. `ST_DumpAsPolygons` preserves distinct
32-bit integer pixel values as separate values when forming polygons.

### Route GDAL debugging to PostgreSQL logs

Enable `postgis.gdal_cpl_debug` to route GDAL debug messages to PostgreSQL logs:

```sql
SET postgis.gdal_cpl_debug = on;
```

Files in this skill

  • SKILL.md3.8 KB
  • references/breaking-changes.md2.4 KB
  • references/postgis-3.5-3.6-details.md3.9 KB
  • references/raster-and-topology.md1.5 KB
  • references/sfcgal-functions.md1.6 KB
  • references/spatial-processing.md1.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data-ai →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.