1
0
Fork 0

Merging upstream version 26.14.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-16 09:04:43 +02:00
parent 68f1150572
commit e9f53ab285
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
84 changed files with 63872 additions and 61909 deletions

View file

@ -1025,6 +1025,12 @@ class Dialect(metaclass=_Dialect):
def version(self) -> Version:
return Version(self.settings.get("version", None))
def generate_values_aliases(self, expression: exp.Values) -> t.List[exp.Identifier]:
return [
exp.to_identifier(f"_col_{i}")
for i, _ in enumerate(expression.expressions[0].expressions)
]
DialectType = t.Union[str, Dialect, t.Type[Dialect], None]
@ -1297,7 +1303,9 @@ def no_timestamp_sql(self: Generator, expression: exp.Timestamp) -> str:
if not zone:
from sqlglot.optimizer.annotate_types import annotate_types
target_type = annotate_types(expression).type or exp.DataType.Type.TIMESTAMP
target_type = (
annotate_types(expression, dialect=self.dialect).type or exp.DataType.Type.TIMESTAMP
)
return self.sql(exp.cast(expression.this, target_type))
if zone.name.lower() in TIMEZONES:
return self.sql(
@ -1864,7 +1872,7 @@ def build_timetostr_or_tochar(args: t.List, dialect: Dialect) -> exp.TimeToStr |
if this and not this.type:
from sqlglot.optimizer.annotate_types import annotate_types
annotate_types(this)
annotate_types(this, dialect=dialect)
if this.is_type(*exp.DataType.TEMPORAL_TYPES):
dialect_name = dialect.__class__.__name__.lower()
return build_formatted_time(exp.TimeToStr, dialect_name, default=True)(args)