Adding upstream version 26.1.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
09521056ff
commit
d908bee480
119 changed files with 71635 additions and 68059 deletions
|
@ -27,7 +27,6 @@ from sqlglot.dialects.dialect import (
|
|||
build_timestamp_trunc,
|
||||
rename_func,
|
||||
sha256_sql,
|
||||
str_position_sql,
|
||||
struct_extract_sql,
|
||||
timestamptrunc_sql,
|
||||
timestrtotime_sql,
|
||||
|
@ -370,6 +369,7 @@ class Postgres(Dialect):
|
|||
|
||||
FUNCTIONS = {
|
||||
**parser.Parser.FUNCTIONS,
|
||||
"ASCII": exp.Unicode.from_arg_list,
|
||||
"DATE_TRUNC": build_timestamp_trunc,
|
||||
"DIV": lambda args: exp.cast(
|
||||
binary_from_function(exp.IntDiv)(args), exp.DataType.Type.DECIMAL
|
||||
|
@ -377,6 +377,7 @@ class Postgres(Dialect):
|
|||
"GENERATE_SERIES": _build_generate_series,
|
||||
"JSON_EXTRACT_PATH": build_json_extract_path(exp.JSONExtract),
|
||||
"JSON_EXTRACT_PATH_TEXT": build_json_extract_path(exp.JSONExtractScalar),
|
||||
"LENGTH": lambda args: exp.Length(this=seq_get(args, 0), encoding=seq_get(args, 1)),
|
||||
"MAKE_TIME": exp.TimeFromParts.from_arg_list,
|
||||
"MAKE_TIMESTAMP": exp.TimestampFromParts.from_arg_list,
|
||||
"NOW": exp.CurrentTimestamp.from_arg_list,
|
||||
|
@ -582,7 +583,8 @@ class Postgres(Dialect):
|
|||
]
|
||||
),
|
||||
exp.SHA2: sha256_sql,
|
||||
exp.StrPosition: str_position_sql,
|
||||
exp.StrPosition: lambda self,
|
||||
e: f"POSITION({self.sql(e, 'substr')} IN {self.sql(e, 'this')})",
|
||||
exp.StrToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)),
|
||||
exp.StrToTime: lambda self, e: self.func("TO_TIMESTAMP", e.this, self.format_time(e)),
|
||||
exp.StructExtract: struct_extract_sql,
|
||||
|
@ -605,6 +607,7 @@ class Postgres(Dialect):
|
|||
exp.VariancePop: rename_func("VAR_POP"),
|
||||
exp.Variance: rename_func("VAR_SAMP"),
|
||||
exp.Xor: bool_xor_sql,
|
||||
exp.Unicode: rename_func("ASCII"),
|
||||
exp.UnixToTime: _unix_to_time_sql,
|
||||
exp.Levenshtein: _levenshtein_sql,
|
||||
}
|
||||
|
@ -716,3 +719,6 @@ class Postgres(Dialect):
|
|||
|
||||
def computedcolumnconstraint_sql(self, expression: exp.ComputedColumnConstraint) -> str:
|
||||
return f"GENERATED ALWAYS AS ({self.sql(expression, 'this')}) STORED"
|
||||
|
||||
def isascii_sql(self, expression: exp.IsAscii) -> str:
|
||||
return f"({self.sql(expression.this)} ~ '^[[:ascii:]]*$')"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue