Skip to content

Limit/Offset alters select statement by adding row_num #340

@mark-at-tusksoft

Description

@mark-at-tusksoft

Using SqlServerCompiler and running queries against SqlServer2017 (composing queries then feeding resulting queries as sql to EF context).

When I compile a query using .ForPage(), it wraps my intended query as a subquery with an extra ROW_NUMBER() column for ordering and the outer query uses a select * which brings along that extra row_num column. Since I have to specify the structure returned (in this case long because I am only selecting Ids) this extra column mutates the expected structure.

If this is intended behavior, that's fine, but it needs to be in bold, red font on the docs for Limit and Offset because this is an unexpected side-effect.

Edit: It appears that this happens with Limit().Offset() as well.

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