[GH-ISSUE #841] Export identities raise an error when using mysql #748

Closed
opened 2026-02-27 11:13:21 +03:00 by kerem · 1 comment
Owner

Originally created by @gawel on GitHub (Mar 7, 2016).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/841

Originally assigned to: @tonioo on GitHub.

  File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/modoboa/admin/management/commands/subcommands/_export.py", line 44, in export_identities
    for alr in qset:
  File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/query.py", line 162, in __iter__
    self._fetch_all()
  File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/query.py", line 965, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/query.py", line 238, in iterator
    results = compiler.execute_sql()
  File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 829, in execute_sql
    sql, params = self.as_sql()
  File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 393, in as_sql
    result.append(self.connection.ops.distinct_sql(distinct_fields))
  File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/backends/base/operations.py", line 132, in distinct_sql
    raise NotImplementedError('DISTINCT ON fields is not supported by this database backend')
NotImplementedError: DISTINCT ON fields is not supported by this database backend

Probably caused by https://github.com/tonioo/modoboa/blob/master/modoboa/admin/management/commands/subcommands/_export.py#L40

Don't really know how to handle it

Originally created by @gawel on GitHub (Mar 7, 2016). Original GitHub issue: https://github.com/modoboa/modoboa/issues/841 Originally assigned to: @tonioo on GitHub. ``` File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/modoboa/admin/management/commands/subcommands/_export.py", line 44, in export_identities for alr in qset: File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/query.py", line 162, in __iter__ self._fetch_all() File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/query.py", line 965, in _fetch_all self._result_cache = list(self.iterator()) File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/query.py", line 238, in iterator results = compiler.execute_sql() File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 829, in execute_sql sql, params = self.as_sql() File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 393, in as_sql result.append(self.connection.ops.distinct_sql(distinct_fields)) File "/var/www/modoboa/vtenv/local/lib/python2.7/site-packages/django/db/backends/base/operations.py", line 132, in distinct_sql raise NotImplementedError('DISTINCT ON fields is not supported by this database backend') NotImplementedError: DISTINCT ON fields is not supported by this database backend ``` Probably caused by https://github.com/tonioo/modoboa/blob/master/modoboa/admin/management/commands/subcommands/_export.py#L40 Don't really know how to handle it
kerem 2026-02-27 11:13:21 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@gawel commented on GitHub (Mar 7, 2016):

Looks like DISTINCT ON is only available in postgres. Can't you use DISTINCT ?

<!-- gh-comment-id:193219455 --> @gawel commented on GitHub (Mar 7, 2016): Looks like DISTINCT ON is only available in postgres. Can't you use DISTINCT ?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#748
No description provided.