百度 这条产业链无远弗届、无孔不入,某种程度上讲,其不仅分肥巨量的教育资源,甚至也成为影响教育发展的一个重要渠道。
Opened 4个月 ago
Closed 4个月 ago
Last modified 4个月 ago
#36289 closed Bug (fixed)
Postgres bulk_create error when geometry is null or a different SRID
汇报人: | Joshua Goodwin | 属主: | Simon Charette |
---|---|---|---|
组件: | Database layer (models, ORM) | 版本: | 5.2 |
严重性: | Release blocker | 关键词: | |
抄送: | Simon Charette, Mariusz Felisiak | Triage Stage: | Ready for checkin |
Has patch: | 是 | Needs documentation: | 否 |
Needs tests: | 否 | Patch needs improvement: | 否 |
Easy pickings: | 否 | UI/UX: | 否 |
描述
I have a model with a geometry field like this:
from django.contrib.gis.db import models class Garage(models.Model): name = models.CharField(max_length=100, blank=True) location = models.PointField(null=True, blank=True)
With Django 5.2 and PostgreSQL (17.4 / PostGIS 3.5.2), bulk_create
fails when I try to more than one item with a null location:
Garage.objects.bulk_create([Garage(), Garage()])
InternalError: parse error - invalid geometry LINE 1: ...stimes_garage" ("location") SELECT * FROM UNNEST(('{NULL,NUL... ^ HINT: "NU" <-- parse error at position 2 within geometry
or with an SRID other than the default
Garage.objects.bulk_create([Garage(location="SRID=29902;POINT(624210 307091)"), Garage(location="SRID=29902;POINT(624210 307091)")])
DataError: Geometry SRID (29902) does not match column SRID (4326)
This seems to be a regression in 5.2, maybe related to #35936 (Speeding up Postgres bulk_create by using unnest)
变更历史 (7)
Note:
See TracTickets
for help on using tickets.
Thank you for the report!
Replicated, regression in a16eedcf9c69d8a11d94cac1811018c5b996d491
Basic regression test if useful:
tests/gis_tests/geo3d/models.py
)tests/gis_tests/geo3d/tests.py