From 244a05de60c9417daab9528b51788c3d2a00dc5f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 17 Jan 2023 11:32:12 +0100 Subject: Adding upstream version 10.5.2. Signed-off-by: Daniel Baumann --- tests/test_executor.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/test_executor.py') diff --git a/tests/test_executor.py b/tests/test_executor.py index b705551..f45a5d4 100644 --- a/tests/test_executor.py +++ b/tests/test_executor.py @@ -401,6 +401,36 @@ class TestExecutor(unittest.TestCase): ], ) + def test_correlated_count(self): + tables = { + "parts": [{"pnum": 0, "qoh": 1}], + "supplies": [], + } + + schema = { + "parts": {"pnum": "int", "qoh": "int"}, + "supplies": {"pnum": "int", "shipdate": "int"}, + } + + self.assertEqual( + execute( + """ + select * + from parts + where parts.qoh >= ( + select count(supplies.shipdate) + 1 + from supplies + where supplies.pnum = parts.pnum and supplies.shipdate < 10 + ) + """, + tables=tables, + schema=schema, + ).rows, + [ + (0, 1), + ], + ) + def test_table_depth_mismatch(self): tables = {"table": []} schema = {"db": {"table": {"col": "VARCHAR"}}} -- cgit v1.2.3