#30191: UnicodeDecodeError from non-FK field when using .delete() after Python 3 upgrade -------------------------------------+------------------------------------- Reporter: Ed Morley | Owner: nobody Type: Bug | Status: closed Component: Database layer | Version: 1.11 (models, ORM) | Severity: Normal | Resolution: invalid Keywords: mysql | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Carlton Gibson):
* status: new => closed * resolution: => invalid Comment: I think this would have been better posted elsewhere. See TicketClosingReasons/UseSupportChannels. However... Create some instances: {{{ >>> Group.objects.create(name="a") INSERT INTO "auth_group" ("name") VALUES ('a') RETURNING "auth_group"."id"; args=('a',) [utils.py:111] <Group: a> >>> Group.objects.create(name="b") INSERT INTO "auth_group" ("name") VALUES ('b') RETURNING "auth_group"."id"; args=('b',) [utils.py:111] <Group: b> }}} Delete normally: {{{ >>> Group.objects.all().delete() SELECT "auth_group"."id", "auth_group"."name" FROM "auth_group"; args=() [utils.py:111] ... DELETE FROM "auth_group" WHERE "auth_group"."id" IN (5, 4); args=(5, 4) [utils.py:111] }}} Oops, all fields selected. If we have garbage columns, don't select them: {{{ >>> Group.objects.only('id').delete() SELECT "auth_group"."id" FROM "auth_group"; args=() [utils.py:111] ... DELETE FROM "auth_group" WHERE "auth_group"."id" IN (3, 1); args=(3, 1) [utils.py:111] }}} Yay! -- Ticket URL: <https://code.djangoproject.com/ticket/30191#comment:1> 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/066.a811df9fbe9c55adb6119fb98b66bd4f%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.