#22023: .values() followed by defer() or only() results invalid data or crash ----------------------------------------------+-------------------- Reporter: jtiai | Owner: nobody Type: Bug | Status: new Component: Database layer (models, ORM) | Version: 1.5 Severity: Normal | Keywords: orm Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------------------------+-------------------- Given model
{{{ class MyModel(models.Model): field_a = models.CharField(max_length=100) field_b = models.IntegerField() field_c = models.TextField() }}} Query {{{ MyModel.objects.values().only('field_b') }}} Returns totally incorrect set of fields Query {{{ MyModel.objects.values().defer('field_b') }}} Returns all fields but data is shifted starting from field_b Query {{{ MyModel.objects.values('field_a').only('field_b') }}} Results a crash due malformed SQL. -- Ticket URL: <https://code.djangoproject.com/ticket/22023> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/048.61fc9795fdde506188fe421023b97800%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.