summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/mysql.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dialects/mysql.py')
-rw-r--r--sqlglot/dialects/mysql.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sqlglot/dialects/mysql.py b/sqlglot/dialects/mysql.py
index 3cd99e7..9ab4ce8 100644
--- a/sqlglot/dialects/mysql.py
+++ b/sqlglot/dialects/mysql.py
@@ -94,6 +94,7 @@ def _date_add_sql(kind: str) -> t.Callable[[generator.Generator, exp.DateAdd | e
class MySQL(Dialect):
TIME_FORMAT = "'%Y-%m-%d %T'"
+ DPIPE_IS_STRING_CONCAT = False
# https://prestodb.io/docs/current/functions/datetime.html#mysql-date-functions
TIME_MAPPING = {
@@ -103,7 +104,6 @@ class MySQL(Dialect):
"%h": "%I",
"%i": "%M",
"%s": "%S",
- "%S": "%S",
"%u": "%W",
"%k": "%-H",
"%l": "%-I",
@@ -196,8 +196,14 @@ class MySQL(Dialect):
**parser.Parser.CONJUNCTION,
TokenType.DAMP: exp.And,
TokenType.XOR: exp.Xor,
+ TokenType.DPIPE: exp.Or,
}
+ # MySQL uses || as a synonym to the logical OR operator
+ # https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html#operator_or
+ BITWISE = parser.Parser.BITWISE.copy()
+ BITWISE.pop(TokenType.DPIPE)
+
TABLE_ALIAS_TOKENS = (
parser.Parser.TABLE_ALIAS_TOKENS - parser.Parser.TABLE_INDEX_HINT_TOKENS
)