diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-16 11:37:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-16 11:37:39 +0000 |
commit | f10d022e11dcd1015db1a74ce9f4198ebdcb7f40 (patch) | |
tree | ac7bdc1d214a0f97f991cff14e933f4895ee68e1 /sqlglot/dialects/tsql.py | |
parent | Releasing progress-linux version 18.11.6-1. (diff) | |
download | sqlglot-f10d022e11dcd1015db1a74ce9f4198ebdcb7f40.tar.xz sqlglot-f10d022e11dcd1015db1a74ce9f4198ebdcb7f40.zip |
Merging upstream version 18.13.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/tsql.py')
-rw-r--r-- | sqlglot/dialects/tsql.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sqlglot/dialects/tsql.py b/sqlglot/dialects/tsql.py index d8bea6d..69adb45 100644 --- a/sqlglot/dialects/tsql.py +++ b/sqlglot/dialects/tsql.py @@ -477,7 +477,9 @@ class TSQL(Dialect): returns.set("table", table) return returns - def _parse_convert(self, strict: bool) -> t.Optional[exp.Expression]: + def _parse_convert( + self, strict: bool, safe: t.Optional[bool] = None + ) -> t.Optional[exp.Expression]: to = self._parse_types() self._match(TokenType.COMMA) this = self._parse_conjunction() @@ -513,12 +515,13 @@ class TSQL(Dialect): exp.Cast if strict else exp.TryCast, to=to, this=self.expression(exp.TimeToStr, this=this, format=format_norm), + safe=safe, ) elif to.this == DataType.Type.TEXT: return self.expression(exp.TimeToStr, this=this, format=format_norm) # Entails a simple cast without any format requirement - return self.expression(exp.Cast if strict else exp.TryCast, this=this, to=to) + return self.expression(exp.Cast if strict else exp.TryCast, this=this, to=to, safe=safe) def _parse_user_defined_function( self, kind: t.Optional[TokenType] = None |