Adding upstream version 16.2.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
577b79f5a7
commit
d61627452f
106 changed files with 41940 additions and 40162 deletions
|
@ -183,9 +183,10 @@ def _to_timestamp(args: t.List) -> exp.Expression:
|
|||
|
||||
|
||||
class Postgres(Dialect):
|
||||
null_ordering = "nulls_are_large"
|
||||
time_format = "'YYYY-MM-DD HH24:MI:SS'"
|
||||
time_mapping = {
|
||||
INDEX_OFFSET = 1
|
||||
NULL_ORDERING = "nulls_are_large"
|
||||
TIME_FORMAT = "'YYYY-MM-DD HH24:MI:SS'"
|
||||
TIME_MAPPING = {
|
||||
"AM": "%p",
|
||||
"PM": "%p",
|
||||
"D": "%u", # 1-based day of week
|
||||
|
@ -241,7 +242,6 @@ class Postgres(Dialect):
|
|||
"REFRESH": TokenType.COMMAND,
|
||||
"REINDEX": TokenType.COMMAND,
|
||||
"RESET": TokenType.COMMAND,
|
||||
"RETURNING": TokenType.RETURNING,
|
||||
"REVOKE": TokenType.COMMAND,
|
||||
"SERIAL": TokenType.SERIAL,
|
||||
"SMALLSERIAL": TokenType.SMALLSERIAL,
|
||||
|
@ -258,6 +258,7 @@ class Postgres(Dialect):
|
|||
|
||||
class Parser(parser.Parser):
|
||||
STRICT_CAST = False
|
||||
CONCAT_NULL_OUTPUTS_STRING = True
|
||||
|
||||
FUNCTIONS = {
|
||||
**parser.Parser.FUNCTIONS,
|
||||
|
@ -268,6 +269,7 @@ class Postgres(Dialect):
|
|||
"NOW": exp.CurrentTimestamp.from_arg_list,
|
||||
"TO_CHAR": format_time_lambda(exp.TimeToStr, "postgres"),
|
||||
"TO_TIMESTAMP": _to_timestamp,
|
||||
"UNNEST": exp.Explode.from_arg_list,
|
||||
}
|
||||
|
||||
FUNCTION_PARSERS = {
|
||||
|
@ -303,7 +305,7 @@ class Postgres(Dialect):
|
|||
value = self._parse_bitwise()
|
||||
|
||||
if part and part.is_string:
|
||||
part = exp.Var(this=part.name)
|
||||
part = exp.var(part.name)
|
||||
|
||||
return self.expression(exp.Extract, this=part, expression=value)
|
||||
|
||||
|
@ -328,6 +330,7 @@ class Postgres(Dialect):
|
|||
**generator.Generator.TRANSFORMS,
|
||||
exp.BitwiseXor: lambda self, e: self.binary(e, "#"),
|
||||
exp.ColumnDef: transforms.preprocess([_auto_increment_to_serial, _serial_to_generated]),
|
||||
exp.Explode: rename_func("UNNEST"),
|
||||
exp.JSONExtract: arrow_json_extract_sql,
|
||||
exp.JSONExtractScalar: arrow_json_extract_scalar_sql,
|
||||
exp.JSONBExtract: lambda self, e: self.binary(e, "#>"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue