Merging upstream version 26.6.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
12333df27e
commit
3532bfd564
99 changed files with 40433 additions and 38803 deletions
|
@ -451,6 +451,9 @@ class Generator(metaclass=_Generator):
|
|||
# The function name of the exp.ArraySize expression
|
||||
ARRAY_SIZE_NAME: str = "ARRAY_LENGTH"
|
||||
|
||||
# The syntax to use when altering the type of a column
|
||||
ALTER_SET_TYPE = "SET DATA TYPE"
|
||||
|
||||
# Whether exp.ArraySize should generate the dimension arg too (valid for Postgres & DuckDB)
|
||||
# None -> Doesn't support it at all
|
||||
# False (DuckDB) -> Has backwards-compatible support, but preferably generated without
|
||||
|
@ -3182,7 +3185,9 @@ class Generator(metaclass=_Generator):
|
|||
to_sql = f" {to_sql}" if to_sql else ""
|
||||
action = self.sql(expression, "action")
|
||||
action = f" {action}" if action else ""
|
||||
return f"{safe_prefix or ''}CAST({self.sql(expression, 'this')} AS{to_sql}{format_sql}{action})"
|
||||
default = self.sql(expression, "default")
|
||||
default = f" DEFAULT {default} ON CONVERSION ERROR" if default else ""
|
||||
return f"{safe_prefix or ''}CAST({self.sql(expression, 'this')} AS{to_sql}{default}{format_sql}{action})"
|
||||
|
||||
def currentdate_sql(self, expression: exp.CurrentDate) -> str:
|
||||
zone = self.sql(expression, "this")
|
||||
|
@ -3250,7 +3255,7 @@ class Generator(metaclass=_Generator):
|
|||
collate = f" COLLATE {collate}" if collate else ""
|
||||
using = self.sql(expression, "using")
|
||||
using = f" USING {using}" if using else ""
|
||||
return f"ALTER COLUMN {this} SET DATA TYPE {dtype}{collate}{using}"
|
||||
return f"ALTER COLUMN {this} {self.ALTER_SET_TYPE} {dtype}{collate}{using}"
|
||||
|
||||
default = self.sql(expression, "default")
|
||||
if default:
|
||||
|
@ -4750,3 +4755,10 @@ class Generator(metaclass=_Generator):
|
|||
def xmlnamespace_sql(self, expression: exp.XMLNamespace) -> str:
|
||||
this = self.sql(expression, "this")
|
||||
return this if isinstance(expression.this, exp.Alias) else f"DEFAULT {this}"
|
||||
|
||||
def export_sql(self, expression: exp.Export) -> str:
|
||||
this = self.sql(expression, "this")
|
||||
connection = self.sql(expression, "connection")
|
||||
connection = f"WITH CONNECTION {connection} " if connection else ""
|
||||
options = self.sql(expression, "options")
|
||||
return f"EXPORT DATA {connection}{options} AS {this}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue