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

Pattern match comparisons and generate PostgreSQL row value comparisons #2111

Closed
roji opened this issue Nov 20, 2021 · 3 comments · Fixed by #2112
Closed

Pattern match comparisons and generate PostgreSQL row value comparisons #2111

roji opened this issue Nov 20, 2021 · 3 comments · Fixed by #2112
Assignees
Labels
enhancement New feature or request

Comments

@roji
Copy link
Member

roji commented Nov 20, 2021

PG supports (x, y) > (1, 2), which is the same as x > 1 || x == 1 && y > 2. We can pattern-match the latter and simplify it to the former.

For background, this is particularly useful for keyset pagination with multiple columns.

Not sure if the simplification has actual benefits beyond prettier SQL - but this is a weekend project for playing around with expression trees :)

@roji roji added the enhancement New feature or request label Nov 20, 2021
@roji roji added this to the 7.0.0 milestone Nov 20, 2021
@roji roji self-assigned this Nov 20, 2021
roji added a commit to roji/efcore.pg that referenced this issue Nov 20, 2021
roji added a commit that referenced this issue Nov 20, 2021
@roji
Copy link
Member Author

roji commented Nov 25, 2021

Assuming we do something in dotnet/efcore#26822, this should be reverted.

@roji roji reopened this Nov 25, 2021
@roji
Copy link
Member Author

roji commented Jan 13, 2022

I am reverting this. As per dotnet/efcore#26822 (comment), the right way for users to specify this is via C# tuple syntax - even if that isn't supported today (except maybe via explicit new ValueTuple(..)). The pattern matching approach here will probably miss various tree shapes, and if it's released it would be problematic to remove it later.

@roji
Copy link
Member Author

roji commented May 4, 2022

Note: #2349 represents a better approach to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant