1
0
Fork 0

Merging upstream version 25.24.5.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:55:40 +01:00
parent f2b92bd29a
commit 1763c7a4ef
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
80 changed files with 61531 additions and 59444 deletions

View file

@ -134,6 +134,7 @@ class Redshift(Postgres):
"TOP": TokenType.TOP,
"UNLOAD": TokenType.COMMAND,
"VARBYTE": TokenType.VARBINARY,
"BINARY VARYING": TokenType.VARBINARY,
}
KEYWORDS.pop("VALUES")
@ -184,6 +185,7 @@ class Redshift(Postgres):
exp.DateDiff: date_delta_sql("DATEDIFF"),
exp.DistKeyProperty: lambda self, e: self.func("DISTKEY", e.this),
exp.DistStyleProperty: lambda self, e: self.naked_property(e),
exp.Explode: lambda self, e: self.explode_sql(e),
exp.FromBase: rename_func("STRTOL"),
exp.GeneratedAsIdentityColumnConstraint: generatedasidentitycolumnconstraint_sql,
exp.JSONExtract: json_extract_segments("JSON_EXTRACT_PATH_TEXT"),
@ -388,11 +390,16 @@ class Redshift(Postgres):
args = expression.expressions
num_args = len(args)
if num_args > 1:
if num_args != 1:
self.unsupported(f"Unsupported number of arguments in UNNEST: {num_args}")
return ""
if isinstance(expression.find_ancestor(exp.From, exp.Join, exp.Select), exp.Select):
self.unsupported("Unsupported UNNEST when not used in FROM/JOIN clauses")
return ""
arg = self.sql(seq_get(args, 0))
alias = self.expressions(expression.args.get("alias"), key="columns", flat=True)
return f"{arg} AS {alias}" if alias else arg
@ -434,3 +441,7 @@ class Redshift(Postgres):
return super().array_sql(expression)
return rename_func("ARRAY")(self, expression)
def explode_sql(self, expression: exp.Explode) -> str:
self.unsupported("Unsupported EXPLODE() function")
return ""