EF5: EntityFunctions.AddMonths() not working for negative values?
Posted: 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
executing this query
returns this error
Sample project here: http://puu.sh/doTOz/46f87e72d8.zip
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();
}
Code: Select all
{Error: 22007: invalid input syntax for type interval: " -("Extent1"."Month") MONTH"}