SQL for DbFunctions.CreateDateTime does not work
------------------------------------------------
Key: DNET-937
URL: http://tracker.firebirdsql.org/browse/DNET-937
Project: .NET Data provider
Issue Type: Bug
Components: Entity Framework
Affects Versions: 7.5.0.0
Reporter: Daniel Richter
Assignee: Jiri Cincura
Calling the DbFunctions method
CreateDateTime(int? year,int? month,int? day,int? hour,int? minute,double? second)
generates SQL code that is not executable.
The SQL generating method (HandleCanonicalFunctionCreateDateTime) assumes that all parameters are constants and all parameters are not null. Additionally, the parameter for seconds is of type double so the generated SQL contains a CAST inside a timestamp literal (so it won't work even if all parameters a non-null constants).
The call DbFunctions.CreateDateTime(2020,3,19,12,0,0) is translated to
CAST('2020-3-19 12:0:CAST(0 AS DOUBLE PRECISION)' AS TIMESTAMP)
The call DbFunctions.CreateDateTime(2020,3,19,null,null,null) is translated to
CAST('2020-3-19 NULL:NULL:NULL' AS TIMESTAMP)
The call DbFunctions.CreateDateTime(c.BirthYear,1,1,null,null,null) is translated to
CAST('"C"."BIRTHYEAR"-1-1 NULL:NULL:NULL' AS TIMESTAMP)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|