Skip to content

order_by on relationship not working for default ordering #109

@jwaschkau

Description

@jwaschkau

Django: 3.2.12
mssql-django: 1.1.2
SQL Server: 15.0.4153.1

When using

class Meta:
  ordering = ('my_relationship__my_value')

i get following error:

ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Driver 13 for
    SQL Server][SQL Server]The ORDER BY clause is invalid in views,
    inline functions, derived tables, subqueries, and common table
    expressions, unless TOP, OFFSET or FOR XML is also specified.
    (1033) (SQLExecDirectW)')

Seems to be a similar problem to mssql/compiler.py

I will provide more information on this issue at a later date if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions