1
0
Fork 0

Adding upstream version 26.8.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-04 07:54:33 +01:00
parent 4b797b16f0
commit 4c394df415
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
61 changed files with 43883 additions and 41898 deletions

View file

@ -314,6 +314,10 @@ class TestDuckDB(Validator):
self.validate_identity(
"""SELECT '{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }' ->> ['$.family', '$.species']""",
)
self.validate_identity(
"SELECT 20_000 AS literal",
"SELECT 20000 AS literal",
)
self.validate_identity(
"""SELECT JSON_EXTRACT_STRING('{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }', ['$.family', '$.species'])""",
"""SELECT '{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }' ->> ['$.family', '$.species']""",
@ -403,6 +407,14 @@ class TestDuckDB(Validator):
self.validate_all("0x1010", write={"": "0 AS x1010"})
self.validate_all("x ~ y", write={"duckdb": "REGEXP_MATCHES(x, y)"})
self.validate_all("SELECT * FROM 'x.y'", write={"duckdb": 'SELECT * FROM "x.y"'})
self.validate_all(
"COUNT_IF(x)",
write={
"duckdb": "COUNT_IF(x)",
"duckdb, version=1.0": "SUM(CASE WHEN x THEN 1 ELSE 0 END)",
"duckdb, version=1.2": "COUNT_IF(x)",
},
)
self.validate_all(
"SELECT STRFTIME(CAST('2020-01-01' AS TIMESTAMP), CONCAT('%Y', '%m'))",
write={
@ -410,6 +422,13 @@ class TestDuckDB(Validator):
"tsql": "SELECT FORMAT(CAST('2020-01-01' AS DATETIME2), CONCAT('yyyy', 'MM'))",
},
)
self.validate_all(
"""SELECT CAST('{"x": 1}' AS JSON)""",
read={
"duckdb": """SELECT '{"x": 1}'::JSON""",
"postgres": """SELECT '{"x": 1}'::JSONB""",
},
)
self.validate_all(
"SELECT * FROM produce PIVOT(SUM(sales) FOR quarter IN ('Q1', 'Q2'))",
read={
@ -910,6 +929,10 @@ class TestDuckDB(Validator):
"postgres": "SELECT 'ThOmAs' ~* 'thomas'",
},
)
self.validate_identity(
"SELECT DATE_ADD(CAST('2020-01-01' AS DATE), INTERVAL 1 DAY)",
"SELECT CAST('2020-01-01' AS DATE) + INTERVAL '1' DAY",
)
def test_array_index(self):
with self.assertLogs(helper_logger) as cm:
@ -929,15 +952,15 @@ class TestDuckDB(Validator):
)
self.validate_identity(
"""SELECT LIST_VALUE(1)[i]""",
"""SELECT ([1])[i]""",
"""SELECT [1][i]""",
)
self.validate_identity(
"""{'x': LIST_VALUE(1)[i]}""",
"""{'x': ([1])[i]}""",
"""{'x': [1][i]}""",
)
self.validate_identity(
"""SELECT LIST_APPLY(RANGE(1, 4), i -> {'f1': LIST_VALUE(1, 2, 3)[i], 'f2': LIST_VALUE(1, 2, 3)[i]})""",
"""SELECT LIST_APPLY(RANGE(1, 4), i -> {'f1': ([1, 2, 3])[i], 'f2': ([1, 2, 3])[i]})""",
"""SELECT LIST_APPLY(RANGE(1, 4), i -> {'f1': [1, 2, 3][i], 'f2': [1, 2, 3][i]})""",
)
self.assertEqual(