[5.2.x] Fixed #36107 -- Adjusted UNNEST bulk_create strategy to opt-out sized arrays.

The array fields opt-out heuristic failed to account for sized arrays.

Note that we keep relying on db_type as opposed to performing an ArrayField
instance check against the column's field as there could be other
implementations of model fields that use Postgres arrays to store the
optimization must be disabled for all of them.

Refs #35936.

Thanks Claude Paroz for the report and test.

Backport of 22fc151bb8 from main.
This commit is contained in:
Simon Charette 2025-01-17 13:41:22 -05:00 committed by Sarah Boyce
parent dab04b89af
commit ad6bca92a8
4 changed files with 38 additions and 1 deletions

View file

@ -64,6 +64,10 @@ class DateTimeArrayModel(PostgreSQLModel):
times = ArrayField(models.TimeField())
class WithSizeArrayModel(PostgreSQLModel):
field = ArrayField(models.FloatField(), size=3)
class NestedIntegerArrayModel(PostgreSQLModel):
field = ArrayField(ArrayField(models.IntegerField()))