Fixed #30385 -- Restored SearchVector(config) immutability.

Regression in 1a28dc3887.

The usage of CONCAT to allow SearchVector to deal with non-text fields
made the generated expression non-IMMUTABLE which prevents a functional
index to be created for it.

Using a combination of COALESCE and ::text makes sure the expression
preserves its immutability.

Refs #29582. Thanks Andrew Brown for the report, Nick Pope for the
review.
This commit is contained in:
Simon Charette 2019-04-19 02:39:25 -04:00 committed by Mariusz Felisiak
parent 34a68c2cbe
commit 405c836336
3 changed files with 34 additions and 4 deletions

View file

@ -42,3 +42,7 @@ Bugfixes
* Fixed a regression in Django 2.2 where ``IntegerField`` validation of
database limits crashes if ``limit_value`` attribute in a custom validator is
callable (:ticket:`30328`).
* Fixed a regression in Django 2.2 where
:class:`~django.contrib.postgres.search.SearchVector` generates SQL that is
not indexable (:ticket:`30385`).