Adding upstream version 26.2.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d908bee480
commit
7ee28625fb
85 changed files with 57142 additions and 52288 deletions
|
@ -528,7 +528,7 @@ class TestDialect(Validator):
|
|||
"sqlite": "SELECT (NOT x GLOB CAST(x'2a5b5e012d7f5d2a' AS TEXT))",
|
||||
"mysql": "SELECT REGEXP_LIKE(x, '^[[:ascii:]]*$')",
|
||||
"postgres": "SELECT (x ~ '^[[:ascii:]]*$')",
|
||||
"tsql": "SELECT (PATINDEX('%[^' + CHAR(0x00) + '-' + CHAR(0x7f) + ']%' COLLATE Latin1_General_BIN, x) = 0)",
|
||||
"tsql": "SELECT (PATINDEX(CONVERT(VARCHAR(MAX), 0x255b5e002d7f5d25) COLLATE Latin1_General_BIN, x) = 0)",
|
||||
"oracle": "SELECT NVL(REGEXP_LIKE(x, '^[' || CHR(1) || '-' || CHR(127) || ']*$'), TRUE)",
|
||||
},
|
||||
)
|
||||
|
@ -1686,7 +1686,7 @@ class TestDialect(Validator):
|
|||
write={
|
||||
"drill": "STRPOS(haystack, needle)",
|
||||
"duckdb": "STRPOS(haystack, needle)",
|
||||
"postgres": "POSITION(needle IN haystack)",
|
||||
"postgres": "STRPOS(haystack, needle)",
|
||||
"presto": "STRPOS(haystack, needle)",
|
||||
"spark": "LOCATE(needle, haystack)",
|
||||
"clickhouse": "position(haystack, needle)",
|
||||
|
@ -1699,7 +1699,7 @@ class TestDialect(Validator):
|
|||
write={
|
||||
"drill": "STRPOS(haystack, needle)",
|
||||
"duckdb": "STRPOS(haystack, needle)",
|
||||
"postgres": "POSITION(needle IN haystack)",
|
||||
"postgres": "STRPOS(haystack, needle)",
|
||||
"presto": "STRPOS(haystack, needle)",
|
||||
"bigquery": "STRPOS(haystack, needle)",
|
||||
"spark": "LOCATE(needle, haystack)",
|
||||
|
@ -1711,8 +1711,9 @@ class TestDialect(Validator):
|
|||
self.validate_all(
|
||||
"POSITION(needle, haystack, pos)",
|
||||
write={
|
||||
"drill": "STRPOS(SUBSTR(haystack, pos), needle) + pos - 1",
|
||||
"presto": "STRPOS(SUBSTR(haystack, pos), needle) + pos - 1",
|
||||
"drill": "`IF`(STRPOS(SUBSTR(haystack, pos), needle) = 0, 0, STRPOS(SUBSTR(haystack, pos), needle) + pos - 1)",
|
||||
"presto": "IF(STRPOS(SUBSTR(haystack, pos), needle) = 0, 0, STRPOS(SUBSTR(haystack, pos), needle) + pos - 1)",
|
||||
"postgres": "CASE WHEN STRPOS(SUBSTR(haystack, pos), needle) = 0 THEN 0 ELSE STRPOS(SUBSTR(haystack, pos), needle) + pos - 1 END",
|
||||
"spark": "LOCATE(needle, haystack, pos)",
|
||||
"clickhouse": "position(haystack, needle, pos)",
|
||||
"snowflake": "POSITION(needle, haystack, pos)",
|
||||
|
@ -2335,6 +2336,17 @@ SELECT
|
|||
},
|
||||
)
|
||||
|
||||
# needs to preserve the target alias in then WHEN condition and function but not in the THEN clause
|
||||
self.validate_all(
|
||||
"""MERGE INTO foo AS target USING (SELECT a, b FROM tbl) AS src ON src.a = target.a
|
||||
WHEN MATCHED THEN UPDATE SET target.b = COALESCE(src.b, target.b)
|
||||
WHEN NOT MATCHED THEN INSERT (target.a, target.b) VALUES (src.a, src.b)""",
|
||||
write={
|
||||
"trino": """MERGE INTO foo AS target USING (SELECT a, b FROM tbl) AS src ON src.a = target.a WHEN MATCHED THEN UPDATE SET b = COALESCE(src.b, target.b) WHEN NOT MATCHED THEN INSERT (a, b) VALUES (src.a, src.b)""",
|
||||
"postgres": """MERGE INTO foo AS target USING (SELECT a, b FROM tbl) AS src ON src.a = target.a WHEN MATCHED THEN UPDATE SET b = COALESCE(src.b, target.b) WHEN NOT MATCHED THEN INSERT (a, b) VALUES (src.a, src.b)""",
|
||||
},
|
||||
)
|
||||
|
||||
def test_substring(self):
|
||||
self.validate_all(
|
||||
"SUBSTR('123456', 2, 3)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue