fix(cadastre): cad_territorial_zones MULTIPOLYGON typmod + ST_Multi coercion (#1344) #1673

Merged
lekss361 merged 1 commit from fix/cad-zones-multipolygon-1344 into main 2026-06-17 17:45:27 +00:00
Owner

Проблема (#1344)

cad_territorial_zones.geom объявлена GEOGRAPHY(POLYGON, 4326), а НСПД ПЗЗ-зоны часто MultiPolygon → нарушают typmod, ловятся per-row begin_nested savepoint и молча отбрасываются. Неполное ПЗЗ-покрытие в G1-gate без видимой ошибки.

Решение (зеркалит upsert_zouit)

  • Миграция 159_alter_cad_territorial_zones_multipolygon.sqlALTER COLUMN geom TYPE geography(MultiPolygon,4326) USING ST_Multi(geom::geometry). Идемпотентна (DO-block проверяет geometry_columns.type), GIST-индекс пересоздаётся, зависимых view нет. Стиль повторяет прецедент 93_cad_parcels_geom_multipolygon.sql.
  • bulk_harvest.py _save_territorial_zones: geom_type-фильтр (только Polygon/MultiPolygon, иначе NULL + log) + ST_Multi(...) в INSERT.

Verify

  • ruff clean, py_compile ok.
  • pytest -k "harvest or territorial or zouit"95 passed, 1 skipped, 0 failed.
  • Других мест с POLYGON-only допущением для таблицы нет.

Closes #1344

## Проблема (#1344) `cad_territorial_zones.geom` объявлена `GEOGRAPHY(POLYGON, 4326)`, а НСПД ПЗЗ-зоны часто MultiPolygon → нарушают typmod, ловятся per-row `begin_nested` savepoint и молча отбрасываются. Неполное ПЗЗ-покрытие в G1-gate без видимой ошибки. ## Решение (зеркалит upsert_zouit) - Миграция `159_alter_cad_territorial_zones_multipolygon.sql` — `ALTER COLUMN geom TYPE geography(MultiPolygon,4326) USING ST_Multi(geom::geometry)`. Идемпотентна (DO-block проверяет `geometry_columns.type`), GIST-индекс пересоздаётся, зависимых view нет. Стиль повторяет прецедент `93_cad_parcels_geom_multipolygon.sql`. - `bulk_harvest.py` `_save_territorial_zones`: geom_type-фильтр (только Polygon/MultiPolygon, иначе NULL + log) + `ST_Multi(...)` в INSERT. ## Verify - `ruff` clean, `py_compile` ok. - `pytest -k "harvest or territorial or zouit"` → **95 passed, 1 skipped, 0 failed**. - Других мест с POLYGON-only допущением для таблицы нет. Closes #1344
lekss361 added 1 commit 2026-06-17 17:26:18 +00:00
fix(cadastre): cad_territorial_zones MULTIPOLYGON typmod + ST_Multi coercion (#1344)
Some checks failed
CI / changes (push) Successful in 12s
CI / changes (pull_request) Successful in 10s
CI / frontend-tests (push) Has been skipped
CI / openapi-codegen-check (push) Successful in 2m12s
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Successful in 1m42s
CI / backend-tests (push) Failing after 9m11s
CI / backend-tests (pull_request) Failing after 8m55s
13327e5a2c
lekss361 merged commit 11fe22b49a into main 2026-06-17 17:45:27 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#1673
No description provided.