Adding upstream version 26.6.0.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This commit is contained in:
parent
cfc058b43a
commit
4b797b16f0
99 changed files with 40433 additions and 38803 deletions
|
@ -33,11 +33,14 @@ from sqlglot.dialects.dialect import (
|
|||
trim_sql,
|
||||
ts_or_ds_add_cast,
|
||||
strposition_sql,
|
||||
count_if_to_sum,
|
||||
)
|
||||
from sqlglot.generator import unsupported_args
|
||||
from sqlglot.helper import is_int, seq_get
|
||||
from sqlglot.parser import binary_range_parser
|
||||
from sqlglot.tokens import TokenType
|
||||
|
||||
|
||||
DATE_DIFF_FACTOR = {
|
||||
"MICROSECOND": " * 1000000",
|
||||
"MILLISECOND": " * 1000",
|
||||
|
@ -391,6 +394,13 @@ class Postgres(Dialect):
|
|||
"SHA384": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(384)),
|
||||
"SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
|
||||
"LEVENSHTEIN_LESS_EQUAL": _build_levenshtein_less_equal,
|
||||
"JSON_OBJECT_AGG": lambda args: exp.JSONObjectAgg(expressions=args),
|
||||
"JSONB_OBJECT_AGG": exp.JSONBObjectAgg.from_arg_list,
|
||||
}
|
||||
|
||||
NO_PAREN_FUNCTIONS = {
|
||||
**parser.Parser.NO_PAREN_FUNCTIONS,
|
||||
TokenType.CURRENT_SCHEMA: exp.CurrentSchema,
|
||||
}
|
||||
|
||||
FUNCTION_PARSERS = {
|
||||
|
@ -610,6 +620,9 @@ class Postgres(Dialect):
|
|||
exp.Unicode: rename_func("ASCII"),
|
||||
exp.UnixToTime: _unix_to_time_sql,
|
||||
exp.Levenshtein: _levenshtein_sql,
|
||||
exp.JSONObjectAgg: rename_func("JSON_OBJECT_AGG"),
|
||||
exp.JSONBObjectAgg: rename_func("JSONB_OBJECT_AGG"),
|
||||
exp.CountIf: count_if_to_sum,
|
||||
}
|
||||
|
||||
TRANSFORMS.pop(exp.CommentColumnConstraint)
|
||||
|
@ -723,3 +736,7 @@ class Postgres(Dialect):
|
|||
|
||||
def isascii_sql(self, expression: exp.IsAscii) -> str:
|
||||
return f"({self.sql(expression.this)} ~ '^[[:ascii:]]*$')"
|
||||
|
||||
@unsupported_args("this")
|
||||
def currentschema_sql(self, expression: exp.CurrentSchema) -> str:
|
||||
return "CURRENT_SCHEMA"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue