EF5: EntityFunctions.AddMonths() not working for negative values?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
acsdeveloper
Posts: 3
Joined: Fri 05 Dec 2014 13:31

EF5: EntityFunctions.AddMonths() not working for negative values?

Post by acsdeveloper » Wed 10 Dec 2014 14:26

I am using dotConnect for PostgreSQL 7.3.293.0, EF 5 and PostgreSQL 9.3.

For the given database

Code: Select all

CREATE TABLE "Users"
(
  "Id" serial NOT NULL,
  "DateRegistered" timestamp without time zone,
  "Month" integer,
  CONSTRAINT "Users_pkey" PRIMARY KEY ("Id")
);

executing this query

Code: Select all

using (var db = new TestDatabaseContainer())
{
    var users = db.Users
        .Where(x => x.DateRegistered != null &&
                    x.Month != null &&
                    x.DateRegistered.Value >
                    EntityFunctions.AddMonths(DateTime.Today, -x.Month.Value))
        .ToList();
}
returns this error

Code: Select all

{Error: 22007: invalid input syntax for type interval: " -("Extent1"."Month") MONTH"}
Sample project here: http://puu.sh/doTOz/46f87e72d8.zip

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EF5: EntityFunctions.AddMonths() not working for negative values?

Post by Shalex » Thu 11 Dec 2014 10:17

Thank you for your report. We have reproduced the issue and are investigating it. We will notify you about the result.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EF5: EntityFunctions.AddMonths() not working for negative values?

Post by Shalex » Wed 17 Dec 2014 14:24

The bug with SQL generation for AddYears, AddMonths, AddDays, AddHours, AddMinutes, AddSeconds, AddMilliseconds, AddMicroseconds, AddNanoseconds canonical functions is fixed. We will notify you when the corresponding build of dotConnect for PostgreSQL is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EF5: EntityFunctions.AddMonths() not working for negative values?

Post by Shalex » Thu 18 Dec 2014 14:51

New build of dotConnect for PostgreSQL 7.3.313 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=3&t=30982.

Post Reply