Merging upstream version 26.11.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
913e13699d
commit
0b9b4fe8cb
52 changed files with 14319 additions and 14244 deletions
|
@ -3120,13 +3120,17 @@ class Generator(metaclass=_Generator):
|
|||
def pivotalias_sql(self, expression: exp.PivotAlias) -> str:
|
||||
alias = expression.args["alias"]
|
||||
|
||||
identifier_alias = isinstance(alias, exp.Identifier)
|
||||
literal_alias = isinstance(alias, exp.Literal)
|
||||
parent = expression.parent
|
||||
pivot = parent and parent.parent
|
||||
|
||||
if identifier_alias and not self.UNPIVOT_ALIASES_ARE_IDENTIFIERS:
|
||||
alias.replace(exp.Literal.string(alias.output_name))
|
||||
elif not identifier_alias and literal_alias and self.UNPIVOT_ALIASES_ARE_IDENTIFIERS:
|
||||
alias.replace(exp.to_identifier(alias.output_name))
|
||||
if isinstance(pivot, exp.Pivot) and pivot.unpivot:
|
||||
identifier_alias = isinstance(alias, exp.Identifier)
|
||||
literal_alias = isinstance(alias, exp.Literal)
|
||||
|
||||
if identifier_alias and not self.UNPIVOT_ALIASES_ARE_IDENTIFIERS:
|
||||
alias.replace(exp.Literal.string(alias.output_name))
|
||||
elif not identifier_alias and literal_alias and self.UNPIVOT_ALIASES_ARE_IDENTIFIERS:
|
||||
alias.replace(exp.to_identifier(alias.output_name))
|
||||
|
||||
return self.alias_sql(expression)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue