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

SQL for DbFunctions.CreateDateTime does not work [DNET937] #860

Closed
firebird-automations opened this issue Mar 19, 2020 · 2 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: Daniel Richter (drichter)

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)

@firebird-automations
Copy link
Author

Commented by: Daniel Richter (drichter)

cincuranet/FirebirdSql.Data.FirebirdClient#95

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: vNext [ 10920 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants