Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with convert function when converting string to date, datet…
…imeoffset, datetime2, datetime, smalldatetime or time (babelfish-for-postgresql#3336) This PR will add fix for following issues: For converting string to datetime2, datetimeoffset and smalldatetime using convert function, we are directly using cast function which will convert the string to given type with default style. Added support to use corresponding SQL helper functions defined which will fix this issue. For conversion of string to date, datetime, smalldatetime and time using convert function, there are helper functions defined but are unable to handle all the supported datetime string literals. Refactored these definitions and fixed this issue. For conversion of string to datetime2 and datetimeoffset using convert function, there are no helper functions defined which handles this conversion as there are for conversion of string to date, datetime, smalldatetime and time. Added definitions to handle these datatypes as well. Function sys.babelfish_get_microsecs_from_fractsecs() is unable to handle the edge case where fractional seconds get overflowed after rounding it to given scale. Function babelfish_get_timeunit_from_string only returns HOURS, MINUTES, SECONDS and FRACTSECONDS from a given time string. Extended this function to return OFFHOURS, OFFMINUTES and OFFSIGN to get details of timeoffset from time string. Cherry-picked from: babelfish-for-postgresql#2622, babelfish-for-postgresql#2653 Task: BABEL-4896 Signed-off-by: Rohit Bhagat [email protected]
- Loading branch information