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

Support for make_date for new DateTime #1204

Closed
richardsheppard-avalara opened this issue Jan 17, 2020 · 1 comment · Fixed by #1481
Closed

Support for make_date for new DateTime #1204

richardsheppard-avalara opened this issue Jan 17, 2020 · 1 comment · Fixed by #1481
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@richardsheppard-avalara
Copy link

richardsheppard-avalara commented Jan 17, 2020

Looking for support translating new DateTime() into make_date in postgresql.

Currently seeing this exception when trying to do so. We are having to apply the date filter in memory right now.

The LINQ expression 'DbSet<Test>
    .Where(f => new DateTime(
        (int)f.Year, 
        (int)f.Month, 
        1
    ))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
   at

Dotnet Core: 3.1
Npgsql.EntityFrameworkCore.PostgreSQL: 3.1.0

@roji roji self-assigned this Jan 17, 2020
@roji roji added the enhancement New feature or request label Jan 17, 2020
@roji roji added this to the 5.0.0 milestone Jan 17, 2020
@roji
Copy link
Member

roji commented Jan 17, 2020

Similar to #1020 which is about NodaTime, but unlike that issue we're not blocked by dotnet/efcore#18797 since we're not a plugin.

SO: https://stackoverflow.com/questions/59656286/how-to-filter-datetime-with-three-fields-day-month-year-in-ef-core-and-postgresq/59792245#59792245

roji added a commit to roji/efcore.pg that referenced this issue Aug 29, 2020
roji added a commit to roji/efcore.pg that referenced this issue Aug 31, 2020
roji added a commit that referenced this issue Aug 31, 2020
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.

2 participants