Skip to content

Document ordering expectations for raw SQL #2806

Open
@kostat

Description

@kostat

Queries of the form

...
.Take()
.Include().ThenInclude()

are translated the following way:

SELECT ...
FROM (
  SELECT ...
  FROM (...
  ) as l
  LIMIT... -- Take()
) as t
JOIN ... -- Include() entity
JOIN ... -- ThenInclude() entity
ORDER BY t... l... -- the extra ORDER BY

An additional ORDER BY overrides any ordering of the most inner FROM (or natural ordering) if it's a raw query.


EF Core version: both 3.1 and 5
Database provider: (tested on PG)
Target framework: .NET Core 3.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions