#31304: PostgreSQL full-text search employs coalesce function for non-null
single-
column searches with SearchVector
-------------------------------------+-------------------------------------
Reporter: Paul Boddie | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer | Version: 2.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: PostgreSQL text | Triage Stage:
search FTS coalesce SearchVector | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
Hey Paul,
> Unfortunately, the use of coalesce now blocks any application of an
index on the column.
Could you elaborate on that? What's preventing you from creating a GIN
functional index on `to_tsvector('simple', coalesce(column, ''))` instead?
I'd suggest you submit your patch as a Github PR so CI can run the full
suite against it.
I suspect the `.null` check won't be enough as some column values mapped
to `null=False` fields can end up being ''null'' when outer joins are
involved and it won't be reflected in `output_field`. In short we can't
drop the `Coalesce` wrapping unless we can guarantee we don't break
backward compatibility here; I wish we forced the usage of `Coalesce` from
the beginning instead but that's not the case.
--
Ticket URL: <https://code.djangoproject.com/ticket/31304#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.fbbcb47553ee07251038ab4042197ba8%40djangoproject.com.