From af3cfc863095e70f752c6b1875ed5c5dbaac2c4a Mon Sep 17 00:00:00 2001 From: James Gillard Date: Sat, 10 Dec 2022 15:46:23 +0000 Subject: [4.1.x] Fixed #34205 -- Fixed Meta.constraints validation crash with ArrayField and __len lookup. Regression in 88fc9e2826044110b7b22577a227f122fe9c1fb5 that began manifesting in Django 4.1. Backport of c5ed884eabf3b2b67581c55bf6c87e721f69157f from main. --- django/contrib/postgres/fields/array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/contrib/postgres/fields/array.py') diff --git a/django/contrib/postgres/fields/array.py b/django/contrib/postgres/fields/array.py index 7269198674..97c6515d95 100644 --- a/django/contrib/postgres/fields/array.py +++ b/django/contrib/postgres/fields/array.py @@ -265,7 +265,7 @@ class ArrayLenTransform(Transform): return ( "CASE WHEN %(lhs)s IS NULL THEN NULL ELSE " "coalesce(array_length(%(lhs)s, 1), 0) END" - ) % {"lhs": lhs}, params + ) % {"lhs": lhs}, params * 2 @ArrayField.register_lookup -- cgit v1.3