Adding upstream version 18.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
9de781a59b
commit
ab14e550ff
124 changed files with 60313 additions and 50346 deletions
|
@ -13,7 +13,7 @@ from sqlglot.helper import seq_get
|
|||
from sqlglot.tokens import TokenType
|
||||
|
||||
|
||||
def _json_sql(self: Postgres.Generator, expression: exp.JSONExtract | exp.JSONExtractScalar) -> str:
|
||||
def _json_sql(self: Redshift.Generator, expression: exp.JSONExtract | exp.JSONExtractScalar) -> str:
|
||||
return f'{self.sql(expression, "this")}."{expression.expression.name}"'
|
||||
|
||||
|
||||
|
@ -37,6 +37,8 @@ class Redshift(Postgres):
|
|||
}
|
||||
|
||||
class Parser(Postgres.Parser):
|
||||
SUPPORTS_USER_DEFINED_TYPES = False
|
||||
|
||||
FUNCTIONS = {
|
||||
**Postgres.Parser.FUNCTIONS,
|
||||
"ADD_MONTHS": lambda args: exp.DateAdd(
|
||||
|
@ -55,9 +57,11 @@ class Redshift(Postgres):
|
|||
}
|
||||
|
||||
def _parse_types(
|
||||
self, check_func: bool = False, schema: bool = False
|
||||
self, check_func: bool = False, schema: bool = False, allow_identifiers: bool = True
|
||||
) -> t.Optional[exp.Expression]:
|
||||
this = super()._parse_types(check_func=check_func, schema=schema)
|
||||
this = super()._parse_types(
|
||||
check_func=check_func, schema=schema, allow_identifiers=allow_identifiers
|
||||
)
|
||||
|
||||
if (
|
||||
isinstance(this, exp.DataType)
|
||||
|
@ -100,6 +104,7 @@ class Redshift(Postgres):
|
|||
QUERY_HINTS = False
|
||||
VALUES_AS_TABLE = False
|
||||
TZ_TO_WITH_TIME_ZONE = True
|
||||
NVL2_SUPPORTED = True
|
||||
|
||||
TYPE_MAPPING = {
|
||||
**Postgres.Generator.TYPE_MAPPING,
|
||||
|
@ -142,6 +147,9 @@ class Redshift(Postgres):
|
|||
# Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)
|
||||
TRANSFORMS.pop(exp.Pow)
|
||||
|
||||
# Redshift supports ANY_VALUE(..)
|
||||
TRANSFORMS.pop(exp.AnyValue)
|
||||
|
||||
RESERVED_KEYWORDS = {*Postgres.Generator.RESERVED_KEYWORDS, "snapshot", "type"}
|
||||
|
||||
def with_properties(self, properties: exp.Properties) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue