This is an automated email from the ASF dual-hosted git repository.
jhyde pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new 523bbf3730 Revert [CALCITE-6222] Mysql does not have to_char function
523bbf3730 is described below
commit 523bbf3730ac1670928ee4e0f54745cc337eefb0
Author: Julian Hyde <[email protected]>
AuthorDate: Fri Jan 26 12:00:43 2024 -0800
Revert [CALCITE-6222] Mysql does not have to_char function
Also clarify, in the javadoc, that while MySQL does not have
TO_CHAR, MariaDB does, and the MYSQL library covers both.
---
.../main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java | 6 ++++--
site/_docs/reference.md | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git
a/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java
b/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java
index 02184cab92..093a25b3a3 100644
--- a/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java
+++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java
@@ -1584,8 +1584,10 @@ public abstract class SqlLibraryOperators {
/** The "TO_CHAR(timestamp, format)" function;
* converts {@code timestamp} to string according to the given {@code
format}.
- */
- @LibraryOperator(libraries = {ORACLE, POSTGRESQL})
+ *
+ * <p>({@code TO_CHAR} is not supported in MySQL, but it is supported in
+ * MariaDB, a variant of MySQL covered by {@link SqlLibrary#MYSQL}.) */
+ @LibraryOperator(libraries = {MYSQL, ORACLE, POSTGRESQL})
public static final SqlFunction TO_CHAR =
SqlBasicFunction.create("TO_CHAR",
ReturnTypes.VARCHAR_2000,
diff --git a/site/_docs/reference.md b/site/_docs/reference.md
index a2cc0c5773..1ba228d312 100644
--- a/site/_docs/reference.md
+++ b/site/_docs/reference.md
@@ -2861,7 +2861,7 @@ In the following:
| b | TIME_DIFF(time, time2, timeUnit) | Returns the whole
number of *timeUnit* between *time* and *time2*
| b | TIME_SUB(time, interval) | Returns the TIME value
that is *interval* before *time*
| b | TIME_TRUNC(time, timeUnit) | Truncates *time* to the
granularity of *timeUnit*, rounding to the beginning of the unit
-| o p | TO_CHAR(timestamp, format) | Converts *timestamp* to a
string using the format *format*
+| m o p | TO_CHAR(timestamp, format) | Converts *timestamp* to
a string using the format *format*
| b | TO_CODE_POINTS(string) | Converts *string* to an
array of integers that represent code points or extended ASCII character values
| o p | TO_DATE(string, format) | Converts *string* to a
date using the format *format*
| o p | TO_TIMESTAMP(string, format) | Converts *string* to a
timestamp using the format *format*