Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default ordering of NULLs when using ORDER BY #5723

Closed
roji opened this issue Jun 10, 2016 · 1 comment
Closed

Default ordering of NULLs when using ORDER BY #5723

roji opened this issue Jun 10, 2016 · 1 comment
Assignees
Milestone

Comments

@roji
Copy link
Member

roji commented Jun 10, 2016

When porting Npgsql to rc3, I got a failure on test Optional_Navigation_Null_Coalesce_To_Clr_Type in the GearsOfWar test suite. The root reason for this is the different ordering of NULLs by ORDER BY clauses: while SqlServer sorts nulls first, PostgreSQL sorts them last by default, but supports the SQL Standard option to specify NULLS FIRST or NULLS LAST.

Beyond this particular failing test, I'm wondering what should be done here. To the extent that we're trying to mimic C#/.NET behavior as much as possible, and .NET behavior seems to be to sort nulls first (LINQ OrderBy, List.Sort...), it seems like the PostgreSQL provider should always render ORDER BY ... NULLS FIRST (this could also be a standard option in DefaultQuerySqlGenerator as this is an SQL Standard feature). On the downside, this goes against the provider's natural behavior (i.e. surprising for PostgreSQL people), and might have some performance impact (not sure about this)

What are your thoughts about this?

@bricelam
Copy link
Contributor

Triage: Where possible, providers should match the semantics of .NET--in this case, order null values first. However, providing a mechanism for users to opt-out might be a good idea given the implications.

@bricelam bricelam self-assigned this Jun 10, 2016
@bricelam bricelam closed this as completed Aug 9, 2016
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants