1
0
Fork 0

Adding upstream version 26.6.0.

Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This commit is contained in:
Daniel Baumann 2025-02-13 22:07:36 +01:00
parent cfc058b43a
commit 4b797b16f0
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
99 changed files with 40433 additions and 38803 deletions

View file

@ -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}"