1
0
Fork 0

Merging upstream version 9.0.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 14:48:46 +01:00
parent ebb36a5fc5
commit 4483b8ff47
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
87 changed files with 7994 additions and 421 deletions

View file

@ -329,6 +329,7 @@ class Parser:
exp.DataType: lambda self: self._parse_types(),
exp.From: lambda self: self._parse_from(),
exp.Group: lambda self: self._parse_group(),
exp.Identifier: lambda self: self._parse_id_var(),
exp.Lateral: lambda self: self._parse_lateral(),
exp.Join: lambda self: self._parse_join(),
exp.Order: lambda self: self._parse_order(),
@ -371,11 +372,8 @@ class Parser:
TokenType.PARAMETER: lambda self, _: exp.Parameter(this=self._parse_var() or self._parse_primary()),
TokenType.BIT_STRING: lambda _, token: exp.BitString(this=token.text),
TokenType.HEX_STRING: lambda _, token: exp.HexString(this=token.text),
TokenType.INTRODUCER: lambda self, token: self.expression(
exp.Introducer,
this=token.text,
expression=self._parse_var_or_string(),
),
TokenType.BYTE_STRING: lambda _, token: exp.ByteString(this=token.text),
TokenType.INTRODUCER: lambda self, token: self._parse_introducer(token),
}
RANGE_PARSERS = {
@ -500,7 +498,7 @@ class Parser:
max_errors=3,
null_ordering=None,
):
self.error_level = error_level or ErrorLevel.RAISE
self.error_level = error_level or ErrorLevel.IMMEDIATE
self.error_message_context = error_message_context
self.index_offset = index_offset
self.unnest_column_only = unnest_column_only
@ -928,6 +926,7 @@ class Parser:
return self.expression(
exp.Delete,
this=self._parse_table(schema=True),
using=self._parse_csv(lambda: self._match(TokenType.USING) and self._parse_table(schema=True)),
where=self._parse_where(),
)
@ -1148,7 +1147,7 @@ class Parser:
def _parse_annotation(self, expression):
if self._match(TokenType.ANNOTATION):
return self.expression(exp.Annotation, this=self._prev.text, expression=expression)
return self.expression(exp.Annotation, this=self._prev.text.strip(), expression=expression)
return expression
@ -1277,7 +1276,7 @@ class Parser:
alias = self._parse_table_alias()
if alias:
this = self.expression(exp.Alias, this=this, alias=alias)
this.set("alias", alias)
if not self.alias_post_tablesample:
table_sample = self._parse_table_sample()
@ -1876,6 +1875,17 @@ class Parser:
self._match_r_paren()
return self.expression(exp.UserDefinedFunction, this=this, expressions=expressions)
def _parse_introducer(self, token):
literal = self._parse_primary()
if literal:
return self.expression(
exp.Introducer,
this=token.text,
expression=literal,
)
return self.expression(exp.Identifier, this=token.text)
def _parse_udf_kwarg(self):
this = self._parse_id_var()
kind = self._parse_types()