#27824: Cannot chain unaccent transform with key lookup in Postgres JSON field -------------------------------------+------------------------------------- Reporter: Aymeric Augustin | Owner: Aymeric | Augustin Type: New feature | Status: assigned Component: contrib.postgres | Version: 1.10 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Aymeric Augustin): Simply adding `from .transforms import Unaccent` in `django.contrib.postgres.fields.jsonb` causes tests to fail with the following exception: {{{ ====================================================================== ERROR: setUpClass (postgres_tests.test_json.TestQuerying) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/myk/Documents/dev/django/django/db/backends/utils.py", line 62, in execute return self.cursor.execute(sql, params) psycopg2.ProgrammingError: column "field" is of type jsonb but expression is of type boolean LINE 1: ...ests_jsonmodel" ("field", "field_custom") VALUES (true, NULL... ^ HINT: You will need to rewrite or cast the expression. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/myk/Documents/dev/django/django/test/testcases.py", line 999, in setUpClass cls.setUpTestData() File "/Users/myk/Documents/dev/django/tests/postgres_tests/test_json.py", line 101, in setUpTestData JSONModel.objects.create(field=True), File "/Users/myk/Documents/dev/django/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/Users/myk/Documents/dev/django/django/db/models/query.py", line 389, in create obj.save(force_insert=True, using=self.db) File "/Users/myk/Documents/dev/django/django/db/models/base.py", line 718, in save force_update=force_update, update_fields=update_fields) File "/Users/myk/Documents/dev/django/django/db/models/base.py", line 748, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/Users/myk/Documents/dev/django/django/db/models/base.py", line 834, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/Users/myk/Documents/dev/django/django/db/models/base.py", line 873, in _do_insert using=using, raw=raw) File "/Users/myk/Documents/dev/django/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/Users/myk/Documents/dev/django/django/db/models/query.py", line 1045, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/Users/myk/Documents/dev/django/django/db/models/sql/compiler.py", line 1092, in execute_sql cursor.execute(sql, params) File "/Users/myk/Documents/dev/django/django/db/backends/utils.py", line 62, in execute return self.cursor.execute(sql, params) File "/Users/myk/Documents/dev/django/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) File "/Users/myk/Documents/dev/django/django/db/backends/utils.py", line 62, in execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: column "field" is of type jsonb but expression is of type boolean LINE 1: ...ests_jsonmodel" ("field", "field_custom") VALUES (true, NULL... ^ HINT: You will need to rewrite or cast the expression. ---------------------------------------------------------------------- }}} This is disturbing. -- Ticket URL: <https://code.djangoproject.com/ticket/27824#comment:5> 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/067.266a044ee363a93f93cb08b6f7f8080d%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.