#31956: QuerySet.order_by() chained with values() crashes on JSONField with a
custom decoder on PostgreSQL.
-------------------------------------+-------------------------------------
Reporter: Marc DEBUREAUX | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Agris Ameriks):
Hello,
I would ask to reopen this ticket.
The fix breaks default functionality of JSONField.
Let me explain the issue.
I have such an model:
{{{
class Instance(models.Model):
title = models.CharField('Title', max_length=255, blank=True)
responses = models.JSONField(default=dict)
}}}
Code:
{{{
query = "SELECT id, responses FROM advancedform_instance"
with connection.cursor() as cursor:
cursor.execute(query)
data = cursor.fetchall()
}}}
In django 3.1 responses is returned as a dict.
In django 3.1.1 it is returned as a string.
If I remove the code that was made to fix the issue, it works correctly.
--
Ticket URL: <https://code.djangoproject.com/ticket/31956#comment:8>
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/064.ddb1f0f686f4395048781513f180b9cd%40djangoproject.com.