Adding upstream version 11.3.6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2f30828945
commit
d160fb48f7
46 changed files with 23416 additions and 22639 deletions
|
@ -59,7 +59,6 @@ class Generator:
|
|||
exp.DateAdd: lambda self, e: self.func(
|
||||
"DATE_ADD", e.this, e.expression, e.args.get("unit")
|
||||
),
|
||||
exp.DateDiff: lambda self, e: self.func("DATEDIFF", e.this, e.expression),
|
||||
exp.TsOrDsAdd: lambda self, e: self.func(
|
||||
"TS_OR_DS_ADD", e.this, e.expression, e.args.get("unit")
|
||||
),
|
||||
|
@ -109,9 +108,6 @@ class Generator:
|
|||
# Whether or not create function uses an AS before the RETURN
|
||||
CREATE_FUNCTION_RETURN_AS = True
|
||||
|
||||
# Whether or not to treat the division operator "/" as integer division
|
||||
INTEGER_DIVISION = True
|
||||
|
||||
# Whether or not MERGE ... WHEN MATCHED BY SOURCE is allowed
|
||||
MATCHED_BY_SOURCE = True
|
||||
|
||||
|
@ -1571,7 +1567,7 @@ class Generator:
|
|||
)
|
||||
else:
|
||||
this = ""
|
||||
unit = expression.args.get("unit")
|
||||
unit = self.sql(expression, "unit")
|
||||
unit = f" {unit}" if unit else ""
|
||||
return f"INTERVAL{this}{unit}"
|
||||
|
||||
|
@ -1757,25 +1753,17 @@ class Generator:
|
|||
return f"{self.sql(expression, 'this')} RESPECT NULLS"
|
||||
|
||||
def intdiv_sql(self, expression: exp.IntDiv) -> str:
|
||||
div = self.binary(expression, "/")
|
||||
return self.sql(exp.Cast(this=div, to=exp.DataType.build("INT")))
|
||||
return self.sql(
|
||||
exp.Cast(
|
||||
this=exp.Div(this=expression.this, expression=expression.expression),
|
||||
to=exp.DataType(this=exp.DataType.Type.INT),
|
||||
)
|
||||
)
|
||||
|
||||
def dpipe_sql(self, expression: exp.DPipe) -> str:
|
||||
return self.binary(expression, "||")
|
||||
|
||||
def div_sql(self, expression: exp.Div) -> str:
|
||||
div = self.binary(expression, "/")
|
||||
|
||||
if not self.INTEGER_DIVISION:
|
||||
return self.sql(exp.Cast(this=div, to=exp.DataType.build("INT")))
|
||||
|
||||
return div
|
||||
|
||||
def floatdiv_sql(self, expression: exp.FloatDiv) -> str:
|
||||
if self.INTEGER_DIVISION:
|
||||
this = exp.Cast(this=expression.this, to=exp.DataType.build("DOUBLE"))
|
||||
return self.div_sql(exp.Div(this=this, expression=expression.expression))
|
||||
|
||||
return self.binary(expression, "/")
|
||||
|
||||
def overlaps_sql(self, expression: exp.Overlaps) -> str:
|
||||
|
@ -1991,3 +1979,9 @@ class Generator:
|
|||
using = f"USING {self.sql(expression, 'using')}"
|
||||
on = f"ON {self.sql(expression, 'on')}"
|
||||
return f"MERGE INTO {this} {using} {on} {self.expressions(expression, sep=' ')}"
|
||||
|
||||
def tochar_sql(self, expression: exp.ToChar) -> str:
|
||||
if expression.args.get("format"):
|
||||
self.unsupported("Format argument unsupported for TO_CHAR/TO_VARCHAR function")
|
||||
|
||||
return self.sql(exp.cast(expression.this, "text"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue