#29500: SQLite functions crashes on NULL values -------------------------------------+------------------------------------- Reporter: Sergey Fedoseev | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 2.0 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Carlton Gibson): Hmmm. Not sure we'll be able to do anything about this. (Postgres certainly behaves better.) Could you [https://docs.python.org/3/library/sqlite3.html#sqlite3.enable_callback_tracebacks enable callback trackbacks] on the client? We can then see the error. I'll guess it'll be this: ``` >>> None ** None Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and 'NoneType' ``` If so we may just have to workaround it by using a function for `pow` which checks for `None`. This works: ``` >>> TestModel.objects.annotate(null=Value(None,output_field=models.IntegerField())).values(pow=models.F('null')).first() {'pow': None} ``` So it's just the `**` operation. -- Ticket URL: <https://code.djangoproject.com/ticket/29500#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/068.8ed48a8299a1bdfc18703db3f6ed5cff%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.