SQL: Fix FORMAT function to better comply with Microsoft SQL Server specification (#86225)

This commit is contained in:
Luigi Dell'Aquila 2022-05-18 12:03:00 +02:00 committed by GitHub
parent fd99a502ee
commit f69c7396d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 303 additions and 41 deletions

View file

@ -454,7 +454,7 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[dateParse1]
[NOTE]
====
The resulting `date` will have the time zone specified by the user through the
The resulting `date` will have the time zone specified by the user through the
<<sql-search-api-time-zone,`time_zone`>>/<<jdbc-cfg-timezone,`timezone`>> REST/driver parameters
with no conversion applied.
@ -810,7 +810,7 @@ SQL Server Format Specification].
[NOTE]
If the 1st argument is of type `time`, then pattern specified by the 2nd argument cannot contain date related units
(e.g. 'dd', 'MM', 'YYYY', etc.). If it contains such units an error is returned. +
(e.g. 'dd', 'MM', 'yyyy', etc.). If it contains such units an error is returned. +
Format specifier `F` will be working similar to format specifier `f`.
It will return the fractional part of seconds, and the number of digits will be same as of the number of `Fs` provided as input (up to 9 digits).
Result will contain `0` appended in the end to match with number of `F` provided.
@ -862,9 +862,9 @@ Patterns for Date/Time Formatting].
If the 1st argument is of type `time`, then the pattern specified by the 2nd argument cannot contain date related units
(e.g. 'dd', 'MM', 'YYYY', etc.). If it contains such units an error is returned. +
The result of the patterns `TZ` and `tz` (time zone abbreviations) in some cases differ from the results returned by the `TO_CHAR`
in PostgreSQL. The reason is that the time zone abbreviations specified by the JDK are different from the ones specified by PostgreSQL.
This function might show an actual time zone abbreviation instead of the generic `LMT` or empty string or offset returned by the PostgreSQL
implementation. The summer/daylight markers might also differ between the two implementations (e.g. will show `HT` instead of `HST`
in PostgreSQL. The reason is that the time zone abbreviations specified by the JDK are different from the ones specified by PostgreSQL.
This function might show an actual time zone abbreviation instead of the generic `LMT` or empty string or offset returned by the PostgreSQL
implementation. The summer/daylight markers might also differ between the two implementations (e.g. will show `HT` instead of `HST`
for Hawaii). +
The `FX`, `TM`, `SP` pattern modifiers are not supported and will show up as `FX`, `TM`, `SP` literals in the output.