1
0
Fork 0

Merging upstream version 23.12.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:32:41 +01:00
parent 1271e5fe1c
commit 740634a4e8
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
93 changed files with 55455 additions and 52777 deletions

View file

@ -79,6 +79,7 @@ class Redshift(Postgres):
alias_tokens: t.Optional[t.Collection[TokenType]] = None,
parse_bracket: bool = False,
is_db_reference: bool = False,
parse_partition: bool = False,
) -> t.Optional[exp.Expression]:
# Redshift supports UNPIVOTing SUPER objects, e.g. `UNPIVOT foo.obj[0] AS val AT attr`
unpivot = self._match(TokenType.UNPIVOT)
@ -145,6 +146,7 @@ class Redshift(Postgres):
exp.DataType.Type.TIMETZ: "TIME",
exp.DataType.Type.TIMESTAMPTZ: "TIMESTAMP",
exp.DataType.Type.VARBINARY: "VARBYTE",
exp.DataType.Type.ROWVERSION: "VARBYTE",
}
TRANSFORMS = {
@ -196,7 +198,165 @@ class Redshift(Postgres):
# Redshift supports LAST_DAY(..)
TRANSFORMS.pop(exp.LastDay)
RESERVED_KEYWORDS = {*Postgres.Generator.RESERVED_KEYWORDS, "snapshot", "type"}
RESERVED_KEYWORDS = {
"aes128",
"aes256",
"all",
"allowoverwrite",
"analyse",
"analyze",
"and",
"any",
"array",
"as",
"asc",
"authorization",
"az64",
"backup",
"between",
"binary",
"blanksasnull",
"both",
"bytedict",
"bzip2",
"case",
"cast",
"check",
"collate",
"column",
"constraint",
"create",
"credentials",
"cross",
"current_date",
"current_time",
"current_timestamp",
"current_user",
"current_user_id",
"default",
"deferrable",
"deflate",
"defrag",
"delta",
"delta32k",
"desc",
"disable",
"distinct",
"do",
"else",
"emptyasnull",
"enable",
"encode",
"encrypt ",
"encryption",
"end",
"except",
"explicit",
"false",
"for",
"foreign",
"freeze",
"from",
"full",
"globaldict256",
"globaldict64k",
"grant",
"group",
"gzip",
"having",
"identity",
"ignore",
"ilike",
"in",
"initially",
"inner",
"intersect",
"interval",
"into",
"is",
"isnull",
"join",
"leading",
"left",
"like",
"limit",
"localtime",
"localtimestamp",
"lun",
"luns",
"lzo",
"lzop",
"minus",
"mostly16",
"mostly32",
"mostly8",
"natural",
"new",
"not",
"notnull",
"null",
"nulls",
"off",
"offline",
"offset",
"oid",
"old",
"on",
"only",
"open",
"or",
"order",
"outer",
"overlaps",
"parallel",
"partition",
"percent",
"permissions",
"pivot",
"placing",
"primary",
"raw",
"readratio",
"recover",
"references",
"rejectlog",
"resort",
"respect",
"restore",
"right",
"select",
"session_user",
"similar",
"snapshot",
"some",
"sysdate",
"system",
"table",
"tag",
"tdes",
"text255",
"text32k",
"then",
"timestamp",
"to",
"top",
"trailing",
"true",
"truncatecolumns",
"type",
"union",
"unique",
"unnest",
"unpivot",
"user",
"using",
"verbose",
"wallet",
"when",
"where",
"with",
"without",
}
def unnest_sql(self, expression: exp.Unnest) -> str:
args = expression.expressions