Adding upstream version 19.0.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
03001ce1e6
commit
6a89523da4
91 changed files with 45416 additions and 43096 deletions
|
@ -2145,6 +2145,22 @@ class PartitionedByProperty(Property):
|
|||
arg_types = {"this": True}
|
||||
|
||||
|
||||
# https://www.postgresql.org/docs/current/sql-createtable.html
|
||||
class PartitionBoundSpec(Expression):
|
||||
# this -> IN / MODULUS, expression -> REMAINDER, from_expressions -> FROM (...), to_expressions -> TO (...)
|
||||
arg_types = {
|
||||
"this": False,
|
||||
"expression": False,
|
||||
"from_expressions": False,
|
||||
"to_expressions": False,
|
||||
}
|
||||
|
||||
|
||||
class PartitionedOfProperty(Property):
|
||||
# this -> parent_table (schema), expression -> FOR VALUES ... / DEFAULT
|
||||
arg_types = {"this": True, "expression": True}
|
||||
|
||||
|
||||
class RemoteWithConnectionModelProperty(Property):
|
||||
arg_types = {"this": True}
|
||||
|
||||
|
@ -2486,6 +2502,7 @@ class Table(Expression):
|
|||
"format": False,
|
||||
"pattern": False,
|
||||
"index": False,
|
||||
"ordinality": False,
|
||||
}
|
||||
|
||||
@property
|
||||
|
@ -2649,11 +2666,7 @@ class Update(Expression):
|
|||
|
||||
|
||||
class Values(UDTF):
|
||||
arg_types = {
|
||||
"expressions": True,
|
||||
"ordinality": False,
|
||||
"alias": False,
|
||||
}
|
||||
arg_types = {"expressions": True, "alias": False}
|
||||
|
||||
|
||||
class Var(Expression):
|
||||
|
@ -3501,7 +3514,7 @@ class Star(Expression):
|
|||
|
||||
|
||||
class Parameter(Condition):
|
||||
arg_types = {"this": True, "wrapped": False}
|
||||
arg_types = {"this": True, "expression": False}
|
||||
|
||||
|
||||
class SessionParameter(Condition):
|
||||
|
@ -5036,7 +5049,7 @@ class FromBase(Func):
|
|||
|
||||
|
||||
class Struct(Func):
|
||||
arg_types = {"expressions": True}
|
||||
arg_types = {"expressions": False}
|
||||
is_var_len_args = True
|
||||
|
||||
|
||||
|
@ -5171,7 +5184,7 @@ class Use(Expression):
|
|||
|
||||
|
||||
class Merge(Expression):
|
||||
arg_types = {"this": True, "using": True, "on": True, "expressions": True}
|
||||
arg_types = {"this": True, "using": True, "on": True, "expressions": True, "with": False}
|
||||
|
||||
|
||||
class When(Func):
|
||||
|
@ -5459,7 +5472,12 @@ def _wrap(expression: E, kind: t.Type[Expression]) -> E | Paren:
|
|||
|
||||
|
||||
def union(
|
||||
left: ExpOrStr, right: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts
|
||||
left: ExpOrStr,
|
||||
right: ExpOrStr,
|
||||
distinct: bool = True,
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
**opts,
|
||||
) -> Union:
|
||||
"""
|
||||
Initializes a syntax tree from one UNION expression.
|
||||
|
@ -5475,19 +5493,25 @@ def union(
|
|||
If an `Expression` instance is passed, it will be used as-is.
|
||||
distinct: set the DISTINCT flag if and only if this is true.
|
||||
dialect: the dialect used to parse the input expression.
|
||||
copy: whether or not to copy the expression.
|
||||
opts: other options to use to parse the input expressions.
|
||||
|
||||
Returns:
|
||||
The new Union instance.
|
||||
"""
|
||||
left = maybe_parse(sql_or_expression=left, dialect=dialect, **opts)
|
||||
right = maybe_parse(sql_or_expression=right, dialect=dialect, **opts)
|
||||
left = maybe_parse(sql_or_expression=left, dialect=dialect, copy=copy, **opts)
|
||||
right = maybe_parse(sql_or_expression=right, dialect=dialect, copy=copy, **opts)
|
||||
|
||||
return Union(this=left, expression=right, distinct=distinct)
|
||||
|
||||
|
||||
def intersect(
|
||||
left: ExpOrStr, right: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts
|
||||
left: ExpOrStr,
|
||||
right: ExpOrStr,
|
||||
distinct: bool = True,
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
**opts,
|
||||
) -> Intersect:
|
||||
"""
|
||||
Initializes a syntax tree from one INTERSECT expression.
|
||||
|
@ -5503,19 +5527,25 @@ def intersect(
|
|||
If an `Expression` instance is passed, it will be used as-is.
|
||||
distinct: set the DISTINCT flag if and only if this is true.
|
||||
dialect: the dialect used to parse the input expression.
|
||||
copy: whether or not to copy the expression.
|
||||
opts: other options to use to parse the input expressions.
|
||||
|
||||
Returns:
|
||||
The new Intersect instance.
|
||||
"""
|
||||
left = maybe_parse(sql_or_expression=left, dialect=dialect, **opts)
|
||||
right = maybe_parse(sql_or_expression=right, dialect=dialect, **opts)
|
||||
left = maybe_parse(sql_or_expression=left, dialect=dialect, copy=copy, **opts)
|
||||
right = maybe_parse(sql_or_expression=right, dialect=dialect, copy=copy, **opts)
|
||||
|
||||
return Intersect(this=left, expression=right, distinct=distinct)
|
||||
|
||||
|
||||
def except_(
|
||||
left: ExpOrStr, right: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts
|
||||
left: ExpOrStr,
|
||||
right: ExpOrStr,
|
||||
distinct: bool = True,
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
**opts,
|
||||
) -> Except:
|
||||
"""
|
||||
Initializes a syntax tree from one EXCEPT expression.
|
||||
|
@ -5531,13 +5561,14 @@ def except_(
|
|||
If an `Expression` instance is passed, it will be used as-is.
|
||||
distinct: set the DISTINCT flag if and only if this is true.
|
||||
dialect: the dialect used to parse the input expression.
|
||||
copy: whether or not to copy the expression.
|
||||
opts: other options to use to parse the input expressions.
|
||||
|
||||
Returns:
|
||||
The new Except instance.
|
||||
"""
|
||||
left = maybe_parse(sql_or_expression=left, dialect=dialect, **opts)
|
||||
right = maybe_parse(sql_or_expression=right, dialect=dialect, **opts)
|
||||
left = maybe_parse(sql_or_expression=left, dialect=dialect, copy=copy, **opts)
|
||||
right = maybe_parse(sql_or_expression=right, dialect=dialect, copy=copy, **opts)
|
||||
|
||||
return Except(this=left, expression=right, distinct=distinct)
|
||||
|
||||
|
@ -5861,7 +5892,7 @@ def to_identifier(name, quoted=None, copy=True):
|
|||
Args:
|
||||
name: The name to turn into an identifier.
|
||||
quoted: Whether or not force quote the identifier.
|
||||
copy: Whether or not to copy a passed in Identefier node.
|
||||
copy: Whether or not to copy name if it's an Identifier.
|
||||
|
||||
Returns:
|
||||
The identifier ast node.
|
||||
|
@ -5882,6 +5913,25 @@ def to_identifier(name, quoted=None, copy=True):
|
|||
return identifier
|
||||
|
||||
|
||||
def parse_identifier(name: str, dialect: DialectType = None) -> Identifier:
|
||||
"""
|
||||
Parses a given string into an identifier.
|
||||
|
||||
Args:
|
||||
name: The name to parse into an identifier.
|
||||
dialect: The dialect to parse against.
|
||||
|
||||
Returns:
|
||||
The identifier ast node.
|
||||
"""
|
||||
try:
|
||||
expression = maybe_parse(name, dialect=dialect, into=Identifier)
|
||||
except ParseError:
|
||||
expression = to_identifier(name)
|
||||
|
||||
return expression
|
||||
|
||||
|
||||
INTERVAL_STRING_RE = re.compile(r"\s*([0-9]+)\s*([a-zA-Z]+)\s*")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue