#34486: SearchVector.as_sql causes AttributeError
--------------------------------------------+------------------------
Reporter: Scott Macpherson | Owner: (none)
Type: Uncategorized | Status: new
Component: contrib.postgres | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+------------------------
Following an upgrade to Django 4.2 and psycopg3, any use of SearchVector
has started returning AttributeError "'NoneType' object has no attribute
'pgconn'".
It seems to be because the instance of DatabaseWrapper passed in to as_sql
doesn't have a connection: DatabaseOperations.compose_sql calls mogrify,
which in turn calls .connection on the DatabaseWrapper, which returns
NoneType.
I've verified that calling connection.connect() in search.py immediately
before the compose_sql line resolves this, but I don't know nearly enough
to know if this is the real root problem, or where in the stack the
connection is supposed to be created if it is.
--
Ticket URL: <https://code.djangoproject.com/ticket/34486>
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/0107018773440872-4e02c6cd-a66f-430d-8974-e5916dcb936b-000000%40eu-central-1.amazonses.com.