6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

refactoring, python tests, added missing test from fbt

This commit is contained in:
Pavel Císař 2021-12-22 20:25:10 +01:00
parent 62202b87c7
commit c8af46bc79
713 changed files with 49874 additions and 14864 deletions

View File

@ -42,8 +42,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT
dt.*
FROM
(SELECT * FROM Table_10 t10) dt;
"""
(SELECT * FROM Table_10 t10) dt;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -58,11 +57,11 @@ expected_stdout_1 = """ ID DESCRIPTION
6 six
7 seven
8 eight
9 nine"""
9 nine"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -42,8 +42,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT
*
FROM
(SELECT * FROM Table_10 t10);
"""
(SELECT * FROM Table_10 t10);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -58,11 +57,11 @@ expected_stdout_1 = """ ID DESCRIPTION
6 six
7 seven
8 eight
9 nine"""
9 nine"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -42,8 +42,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT
dt.*
FROM
(SELECT * FROM Table_10 t10) dt (TEST_ID, TEST_DESC);
"""
(SELECT * FROM Table_10 t10) dt (TEST_ID, TEST_DESC);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -58,11 +57,11 @@ expected_stdout_1 = """ TEST_ID TEST_DESC
6 six
7 seven
8 eight
9 nine"""
9 nine"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -42,8 +42,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT
dt.*
FROM
(SELECT ID, ID FROM Table_10 t10) dt;
"""
(SELECT ID, ID FROM Table_10 t10) dt;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -51,12 +50,11 @@ expected_stderr_1 = """Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Invalid command
-column ID was specified multiple times for derived table DT
"""
-column ID was specified multiple times for derived table DT"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr
assert act_1.clean_stderr == act_1.clean_expected_stderr

View File

@ -42,8 +42,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT
dt.*
FROM
(SELECT * FROM Table_10 t10) dt (ID, ID);
"""
(SELECT * FROM Table_10 t10) dt (ID, ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -51,12 +50,11 @@ expected_stderr_1 = """Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Invalid command
-column ID was specified multiple times for derived table DT
"""
-column ID was specified multiple times for derived table DT"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr
assert act_1.clean_stderr == act_1.clean_expected_stderr

View File

@ -43,8 +43,7 @@ test_script_1 = """SELECT
dt.*
FROM
Table_10 t10
JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);
"""
JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -54,12 +53,11 @@ Dynamic SQL Error
-Column unknown
-T10.ID
-At line 5, column 53
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr
assert act_1.clean_stderr == act_1.clean_expected_stderr

View File

@ -43,8 +43,7 @@ test_script_1 = """SELECT
dt.*
FROM
Table_10 t10
LEFT JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);
"""
LEFT JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -54,12 +53,11 @@ Dynamic SQL Error
-Column unknown
-T10.ID
-At line 5, column 58
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr
assert act_1.clean_stderr == act_1.clean_expected_stderr

View File

@ -43,8 +43,7 @@ test_script_1 = """SELECT
dt.*
FROM
Table_10 t10
FULL JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);
"""
FULL JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -54,12 +53,11 @@ Dynamic SQL Error
-Column unknown
-T10.ID
-At line 5, column 58
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr
assert act_1.clean_stderr == act_1.clean_expected_stderr

View File

@ -43,8 +43,7 @@ test_script_1 = """SELECT
dt.*
FROM
Table_10 t10
FULL JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);
"""
FULL JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -54,12 +53,11 @@ Dynamic SQL Error
-Column unknown
-T10.ID
-At line 5, column 58
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr
assert act_1.clean_stderr == act_1.clean_expected_stderr

View File

@ -44,8 +44,7 @@ test_script_1 = """SELECT
(SELECT dt.Description FROM (SELECT t1.Description FROM
Table_10 t1 WHERE t1.ID = t10.ID) dt) AS Description
FROM
Table_10 t10;
"""
Table_10 t10;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -60,11 +59,11 @@ expected_stdout_1 = """ ID DESCRIPTION
6 six
7 seven
8 eight
9 nine"""
9 nine"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -46,7 +46,7 @@ FROM
Table_10 t10
WHERE
t10.ID IN (SELECT dt.ID FROM (SELECT t1.ID FROM
Table_10 t1 WHERE t1.ID = t10.ID) dt);"""
Table_10 t1 WHERE t1.ID = t10.ID) dt);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -61,11 +61,11 @@ expected_stdout_1 = """ ID DESCRIPTION
6 six
7 seven
8 eight
9 nine"""
9 nine"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -46,7 +46,7 @@ FROM
Table_10 t10
WHERE
EXISTS(SELECT dt.ID FROM (SELECT t1.ID FROM
Table_10 t1 WHERE t1.ID = t10.ID) dt);"""
Table_10 t1 WHERE t1.ID = t10.ID) dt);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -61,11 +61,11 @@ expected_stdout_1 = """ ID DESCRIPTION
6 six
7 seven
8 eight
9 nine"""
9 nine"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -42,8 +42,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT
dt.DESCRIPTION
FROM
(SELECT DISTINCT DESCRIPTION FROM Table_10 t10) dt (DESCRIPTION);
"""
(SELECT DISTINCT DESCRIPTION FROM Table_10 t10) dt (DESCRIPTION);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -56,12 +55,11 @@ nine
one
seven
three
two
"""
two"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -45,19 +45,18 @@ test_script_1 = """SELECT
FROM
(SELECT FIRST 4 SKIP 2 ID, DESCRIPTION FROM Table_10 t10 ORDER BY ID) dt (ID, DESCRIPTION)
WHERE
dt.ID >= 4;
"""
dt.ID >= 4;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """ ID DESCRIPTION
============ ===========
4 four
5 five"""
5 five"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -45,8 +45,7 @@ test_script_1 = """SELECT
FROM
(SELECT t1.ID, t1.DESCRIPTION FROM Table_10 t1 WHERE t1.ID <= 4
UNION ALL
SELECT t1.ID, t1.DESCRIPTION FROM Table_10 t1 WHERE t1.ID >= 5) dt (ID, DESCRIPTION);
"""
SELECT t1.ID, t1.DESCRIPTION FROM Table_10 t1 WHERE t1.ID >= 5) dt (ID, DESCRIPTION);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -61,11 +60,11 @@ expected_stdout_1 = """ ID DESCRIPTION
6 six
7 seven
8 eight
9 nine"""
9 nine"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -43,8 +43,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT
dt.*
FROM
(SELECT t1.GROUPID, Count(t1.ID) FROM Table_10 t1 GROUP BY t1.GROUPID) dt (GROUPID, ID_COUNT);
"""
(SELECT t1.GROUPID, Count(t1.ID) FROM Table_10 t1 GROUP BY t1.GROUPID) dt (GROUPID, ID_COUNT);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -54,12 +53,11 @@ expected_stdout_1 = """ GROUPID ID_COUNT
1 2
2 3
3 4
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -45,20 +45,18 @@ test_script_1 = """SELECT
FROM
(SELECT t1.GROUPID, Count(t1.ID) FROM Table_10 t1 GROUP BY t1.GROUPID) dt (GROUPID, ID_COUNT)
WHERE
dt.ID_COUNT = 2;
"""
dt.ID_COUNT = 2;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """ GROUPID ID_COUNT
============ =====================
1 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -45,8 +45,7 @@ test_script_1 = """SELECT
FROM
(SELECT t1.GROUPID, Count(t1.ID) FROM Table_10 t1 GROUP BY t1.GROUPID) dt (GROUPID, ID_COUNT)
WHERE
dt.GROUPID >= 2;
"""
dt.GROUPID >= 2;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -54,12 +53,11 @@ expected_stdout_1 = """ GROUPID ID_COUNT
============ =====================
2 3
3 4
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -43,8 +43,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SELECT
dt.*
FROM
(SELECT t2.ID, t2.GROUPID, (SELECT t1.GROUPID FROM Table_10 t1 WHERE t1.ID = t2.ID) FROM Table_10 t2) dt (ID, GROUPID1, GROUPID2);
"""
(SELECT t2.ID, t2.GROUPID, (SELECT t1.GROUPID FROM Table_10 t1 WHERE t1.ID = t2.ID) FROM Table_10 t2) dt (ID, GROUPID1, GROUPID2);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -59,11 +58,11 @@ expected_stdout_1 = """ ID GROUPID1 GROUPID2
6 3 3
7 3 3
8 3 3
9 3 3"""
9 3 3"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -50,8 +50,7 @@ FROM
FROM
Table_10 t2
GROUP BY
t2.GROUPID) dt (GROUPID, MIN_ID, MAX_ID);
"""
t2.GROUPID) dt (GROUPID, MIN_ID, MAX_ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -60,11 +59,11 @@ expected_stdout_1 = """ GROUPID MIN_ID MAX_ID
<null> <null> <null>
1 1 2
2 3 5
3 6 9"""
3 6 9"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -45,17 +45,17 @@ test_script_1 = """SELECT
FROM
Table_10 t10
WHERE
t10.ID IN (SELECT MAX(t1.ID) FROM Table_10 t1);"""
t10.ID IN (SELECT MAX(t1.ID) FROM Table_10 t1);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """ ID DESCRIPTION
============ ===========
9 nine"""
9 nine"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -73,8 +73,7 @@ INSERT INTO TABLEA (ID, DESCRIPTION) VALUES (2, 'Red');
INSERT INTO TABLEA (ID, DESCRIPTION) VALUES (4, 'Green');
INSERT INTO TABLEA (ID, DESCRIPTION) VALUES (8, 'Yellow');
COMMIT;
SELECT * FROM TABLEA;
"""
SELECT * FROM TABLEA;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -83,11 +82,11 @@ expected_stdout_1 = """ ID DESCRIPTION
1 Blue <null>
2 Red 1
4 Green 2
8 Yellow 4"""
8 Yellow 4"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -61,7 +61,7 @@ SELECT
FROM
Table_2_10 t
WHERE
t.F1 = 2 and t.F2 >= 6;"""
t.F1 = 2 and t.F2 >= 6;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -74,12 +74,11 @@ expected_stdout_1 = """PLAN (T INDEX (I_TABLE_2_10_ASC))
2 7
2 8
2 9
2 10
"""
2 10"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -61,7 +61,7 @@ SELECT
FROM
Table_2_10 t
WHERE
t.F1 = 2 and t.F2 <= 5;"""
t.F1 = 2 and t.F2 <= 5;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -74,12 +74,11 @@ expected_stdout_1 = """PLAN (T INDEX (I_TABLE_2_10_DESC))
2 2
2 3
2 4
2 5
"""
2 5"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -69,8 +69,7 @@ SET TERM ;^
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """SET PLAN OFF;
SELECT O_FIELD, O_COUNT FROM PR_A_TEST_STARTING_WITH('');
"""
SELECT O_FIELD, O_COUNT FROM PR_A_TEST_STARTING_WITH('');"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -85,5 +84,5 @@ F3 - NOT INDEXED 3"""
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -69,8 +69,7 @@ SET TERM ;^
db_1 = db_factory(charset='ISO8859_1', sql_dialect=3, init=init_script_1)
test_script_1 = """SET PLAN OFF;
SELECT O_FIELD, O_COUNT FROM PR_A_TEST_STARTING_WITH('');
"""
SELECT O_FIELD, O_COUNT FROM PR_A_TEST_STARTING_WITH('');"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -85,5 +84,5 @@ F3 - NOT INDEXED 3"""
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -53,7 +53,7 @@ test_script_1 = """
e.begindatetime >= '1700-01-01'
order by
begindatetime asc;
"""
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -66,11 +66,11 @@ expected_stdout_1 = """
1858-11-17 00:00:00.0000 1858-11-17 00:00:00.0000
1858-11-18 16:00:00.0000 1858-11-18 17:00:00.0000
2004-04-08 02:00:00.0000 2004-04-08 02:09:00.0000
"""
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -63,7 +63,7 @@ SELECT
FROM
Table_66 t66
WHERE
t66.ID <= -131072;"""
t66.ID <= -131072;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -86,11 +86,11 @@ expected_stdout_1 = """PLAN (T66 INDEX (I_TABLE_66_ASC))
-1048576
-524288
-262144
-131072"""
-131072"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -63,7 +63,7 @@ SELECT
FROM
Table_66 t66
WHERE
t66.ID < 0;"""
t66.ID < 0;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -106,12 +106,11 @@ expected_stdout_1 = """PLAN (T66 INDEX (I_TABLE_66_ASC))
-8
-4
-2
-1
"""
-1"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -51,7 +51,7 @@ SELECT
FROM
Table_A15 a15
WHERE
a15.ID <= 'AAAAB';"""
a15.ID <= 'AAAAB';"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -64,12 +64,11 @@ A
AA
AAA
AAAA
AAAAB
"""
AAAAB"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -51,7 +51,7 @@ SELECT
FROM
Table_A15 a15
WHERE
a15.ID < 'AAAB';"""
a15.ID < 'AAAB';"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -64,12 +64,11 @@ A
AA
AAA
AAAA
AAAAB
"""
AAAAB"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -61,7 +61,7 @@ SELECT
FROM
Table_2_10 t
WHERE
t.F1 = 2 and t.F2 <= 5;"""
t.F1 = 2 and t.F2 <= 5;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -74,12 +74,11 @@ expected_stdout_1 = """PLAN (T INDEX (I_TABLE_2_10_ASC))
2 2
2 3
2 4
2 5
"""
2 5"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -63,7 +63,7 @@ SELECT
FROM
Table_66 t66
WHERE
t66.ID >= 131071;"""
t66.ID >= 131071;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -86,12 +86,11 @@ expected_stdout_1 = """PLAN (T66 INDEX (I_TABLE_66_DESC))
1048575
524287
262143
131071
"""
131071"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -63,7 +63,7 @@ SELECT
FROM
Table_66 t66
WHERE
t66.ID > 131071;"""
t66.ID > 131071;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -85,12 +85,11 @@ expected_stdout_1 = """PLAN (T66 INDEX (I_TABLE_66_DESC))
2097151
1048575
524287
262143
"""
262143"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -61,7 +61,7 @@ SELECT
FROM
Table_2_10 t
WHERE
t.F1 = 1 and t.F2 >= 6;"""
t.F1 = 1 and t.F2 >= 6;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -74,12 +74,11 @@ expected_stdout_1 = """PLAN (T INDEX (I_TABLE_2_10_DESC))
1 7
1 8
1 9
1 10
"""
1 10"""
@pytest.mark.version('>=1.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -4,13 +4,13 @@
# title: upper and lower bounds
# decription: equal comparison should be prefered.
# Lower and Upper bounds are bound by the same value.
# tracker_id:
# tracker_id:
# min_versions: []
# versions: 3.0
# qmid: functional.arno.indexes.upper_lower_bounds_01
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import db_factory, python_act, Action
# version: 3.0
# resources: None
@ -81,35 +81,45 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# def show(self):
# print ('sequential : ',self.sequential)
# print ('indexed : ',self.indexed)
#
#
# cursor=db_conn.cursor()
#
#
# ri = readsInformation()
# ri.start()
#
#
# cursor.execute("SELECT Count(*) FROM Table_1000 t1000 WHERE t1000.ID > 1 and t1000.ID >= 100 and t1000.ID = 500 and t1000.ID <= 900 and t1000.ID < 1000")
# printData(cursor)
#
#
# # Get statistics and put out differences
# ri.difference()
# ri.show()
#
#
# #SET PLAN ON;
# #SET STATS ON;
# #SELECT B.B_INFO, A.A_VALUE FROM TableB B LEFT JOIN TableA A ON (1 = 0);
#---
#act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """COUNT
--------------------
1
sequential : {}
indexed : {128: 1}
"""
act_1 = python_act('db_1', substitutions=substitutions_1)
@pytest.mark.version('>=3.0')
@pytest.mark.xfail
def test_1(db_1):
pytest.fail("Test not IMPLEMENTED")
def test_1(act_1: Action):
sequential = {}
indexed = {}
with act_1.db.connect() as con:
for tbl in con.info.get_table_access_stats():
if tbl.table_id >= 128:
sequential[tbl.table_id] = tbl.sequential
indexed[tbl.table_id] = tbl.indexed
with con.cursor() as c:
c.execute("SELECT Count(*) FROM Table_1000 t1000 WHERE t1000.ID > 1 and t1000.ID >= 100 and t1000.ID = 500 and t1000.ID <= 900 and t1000.ID < 1000")
cnt = c.fetchone()[0]
for tbl in con.info.get_table_access_stats():
if tbl.table_id >= 128:
if tbl.sequential:
sequential[tbl.table_id] = tbl.sequential - sequential.get(tbl.table_id, 0)
if tbl.indexed:
indexed[tbl.table_id] = tbl.indexed - indexed.get(tbl.table_id, 0)
# Check
assert cnt == 1
assert sequential == {}
assert indexed == {128: 1}

View File

@ -3,13 +3,13 @@
# id: functional.arno.indices.upper_lower_bounds_02
# title: upper and lower bounds
# decription: "Less or equal than" should be prefered above "less than" and "greater or equal than" above "greater than".
# tracker_id:
# tracker_id:
# min_versions: []
# versions: 3.0
# qmid: functional.arno.indexes.upper_lower_bounds_02
import pytest
from firebird.qa import db_factory, isql_act, Action
from firebird.qa import db_factory, python_act, Action
# version: 3.0
# resources: None
@ -80,35 +80,45 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# def show(self):
# print ('sequential : ',self.sequential)
# print ('indexed : ',self.indexed)
#
#
# cursor=db_conn.cursor()
#
#
# ri = readsInformation()
# ri.start()
#
#
# cursor.execute("SELECT Count(*) FROM Table_1000 t1000 WHERE t1000.ID > 1 and t1000.ID >= 400 and t1000.ID <= 600 and t1000.ID < 1000")
# printData(cursor)
#
#
# # Get statistics and put out differences
# ri.difference()
# ri.show()
#
#
# #SET PLAN ON;
# #SET STATS ON;
# #SELECT B.B_INFO, A.A_VALUE FROM TableB B LEFT JOIN TableA A ON (1 = 0);
#---
#act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """COUNT
--------------------
201
sequential : {}
indexed : {128: 201}
"""
act_1 = python_act('db_1', substitutions=substitutions_1)
@pytest.mark.version('>=3.0')
@pytest.mark.xfail
def test_1(db_1):
pytest.fail("Test not IMPLEMENTED")
def test_1(act_1: Action):
sequential = {}
indexed = {}
with act_1.db.connect() as con:
for tbl in con.info.get_table_access_stats():
if tbl.table_id >= 128:
sequential[tbl.table_id] = tbl.sequential
indexed[tbl.table_id] = tbl.indexed
with con.cursor() as c:
c.execute("SELECT Count(*) FROM Table_1000 t1000 WHERE t1000.ID > 1 and t1000.ID >= 400 and t1000.ID <= 600 and t1000.ID < 1000")
cnt = c.fetchone()[0]
for tbl in con.info.get_table_access_stats():
if tbl.table_id >= 128:
if tbl.sequential:
sequential[tbl.table_id] = tbl.sequential - sequential.get(tbl.table_id, 0)
if tbl.indexed:
indexed[tbl.table_id] = tbl.indexed - indexed.get(tbl.table_id, 0)
# Check
assert cnt == 201
assert sequential == {}
assert indexed == {128: 201}

View File

@ -74,7 +74,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
Count(*) >= 2;"""
Count(*) >= 2;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -86,12 +86,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F NATURAL, C INDEX (PK_COLORS)))
2 White 2
3 Blue 2
4 Yellow 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -81,7 +81,7 @@ HAVING
Count(DISTINCT f.FlowerID) >= 2 and
MIN(DISTINCT f.FlowerID) >= 1 and
MAX(DISTINCT f.FlowerID) >= 1 and
AVG(DISTINCT f.FlowerID) >= 1;"""
AVG(DISTINCT f.FlowerID) >= 1;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -93,12 +93,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F NATURAL, C INDEX (PK_COLORS)))
2 White 2
3 Blue 2
4 Yellow 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -74,7 +74,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
f.ColorID = 1;"""
f.ColorID = 1;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -83,12 +83,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK
COLORID COLORNAME COUNT
============ ==================== =====================
1 Red 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -82,7 +82,7 @@ HAVING
Count(DISTINCT f.FlowerID) >= 2 and
MIN(DISTINCT f.FlowerID) >= 1 and
MAX(DISTINCT f.FlowerID) >= 1 and
AVG(DISTINCT f.FlowerID) >= 1;"""
AVG(DISTINCT f.FlowerID) >= 1;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -91,12 +91,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK
COLORID COLORNAME COUNT
============ ==================== =====================
2 White 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -88,7 +88,7 @@ SELECT
FROM
UsedColors v
WHERE
v.ColorID >= 1;"""
v.ColorID >= 1;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -102,12 +102,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (V F INDEX (FK_FLOWERS_COLORS), V C INDEX
4 Yellow 2
5 Black 1
6 Purple 1
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -90,7 +90,7 @@ FROM
WHERE
v.ColorID >= 2 and
v.ColorID <= 5 and
v.ColorUsed = 2;"""
v.ColorUsed = 2;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -101,12 +101,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (V F INDEX (FK_FLOWERS_COLORS), V C INDEX
2 White 2
3 Blue 2
4 Yellow 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -74,7 +74,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
f.ColorID >= 1;"""
f.ColorID >= 1;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -88,12 +88,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK
4 Yellow 2
5 Black 1
6 Purple 1
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -74,7 +74,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
f.ColorID > 1;"""
f.ColorID > 1;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -87,12 +87,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK
4 Yellow 2
5 Black 1
6 Purple 1
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -74,7 +74,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
f.ColorID <= 4;"""
f.ColorID <= 4;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -86,12 +86,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK
2 White 2
3 Blue 2
4 Yellow 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -74,7 +74,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
f.ColorID < 5;"""
f.ColorID < 5;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -86,12 +86,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK
2 White 2
3 Blue 2
4 Yellow 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -74,7 +74,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
f.ColorID BETWEEN 2 and 4;"""
f.ColorID BETWEEN 2 and 4;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -85,12 +85,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK
2 White 2
3 Blue 2
4 Yellow 2
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -74,16 +74,15 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
f.ColorID IS NULL;"""
f.ColorID IS NULL;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK_COLORS)))
"""
expected_stdout_1 = """PLAN SORT (JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK_COLORS)))"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -75,7 +75,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
c.ColorName STARTING WITH 'B';"""
c.ColorName STARTING WITH 'B';"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -85,12 +85,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (C INDEX (I_COLORS_COLORNAME), F INDEX (F
============ ==================== =====================
3 Blue 2
5 Black 1
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -75,7 +75,7 @@ FROM
GROUP BY
f.ColorID, c.ColorName
HAVING
c.ColorName LIKE 'B%';"""
c.ColorName LIKE 'B%';"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -85,12 +85,11 @@ expected_stdout_1 = """PLAN SORT (JOIN (C INDEX (I_COLORS_COLORNAME), F INDEX (F
============ ==================== =====================
3 Blue 2
5 Black 1
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -37,7 +37,7 @@ test_script_1 = """
select * from t where y < 0;
select * from t where x between 0 and 1;
select * from t where y between 0 and 1;
"""
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -48,11 +48,11 @@ expected_stdout_1 = """
PLAN (T NATURAL)
PLAN (T NATURAL)
PLAN (T NATURAL)
"""
"""
@pytest.mark.version('>=2.5.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -2,14 +2,14 @@
#
# id: functional.arno.optimizer.opt_full_join_01
# title: FULL OUTER JOIN, list all values
# decription:
# decription:
# TableX FULL OUTER JOIN TableY with relation in the ON clause.
# Three tables are used, where 1 table (RC) holds references to the two other tables (R and C).
# Three tables are used, where 1 table (RC) holds references to the two other tables (R and C).
# The two tables R and C contain both 1 value that isn't inside RC.
# =====
# Refactored 01-mar-2016. Checked on: WI-V2.5.6.26970, WI-V3.0.0.32366
#
# tracker_id:
#
# tracker_id:
# min_versions: ['2.5.0']
# versions: 2.5
# qmid: functional.arno.optimizer.opt_full_join_01
@ -22,51 +22,94 @@ from firebird.qa import db_factory, isql_act, Action
substitutions_1 = [('=', ''), ('[ \t]+', ' ')]
init_script_1 = """"""
init_script_1 = """
create table relations (
relationid integer,
relationname varchar(35)
);
create table categories (
categoryid integer,
description varchar(20)
);
create table relationcategories (
relationid integer,
categoryid integer
);
commit;
insert into relations (relationid, relationname) values (1, 'diving snorkel shop');
insert into relations (relationid, relationname) values (2, 'bakery garbage');
insert into relations (relationid, relationname) values (3, 'racing turtle');
insert into relations (relationid, relationname) values (4, 'folding air-hook shop');
insert into categories (categoryid, description) values (1, 'relation');
insert into categories (categoryid, description) values (2, 'debtor');
insert into categories (categoryid, description) values (3, 'creditor');
insert into categories (categoryid, description) values (4, 'newsletter');
insert into relationcategories (relationid, categoryid) values (1, 1);
insert into relationcategories (relationid, categoryid) values (2, 1);
insert into relationcategories (relationid, categoryid) values (3, 1);
insert into relationcategories (relationid, categoryid) values (1, 2);
insert into relationcategories (relationid, categoryid) values (2, 2);
insert into relationcategories (relationid, categoryid) values (1, 3);
commit;
-- Normally these indexes are created by the primary/foreign keys,
-- but we don't want to rely on them for this test
create unique asc index pk_relations on relations (relationid);
create unique asc index pk_categories on categories (categoryid);
create unique asc index pk_relationcategories on relationcategories (relationid, categoryid);
create asc index fk_rc_relations on relationcategories (relationid);
create asc index fk_rc_categories on relationcategories (categoryid);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
#
#
# import os
# import sys
# import time
# import subprocess
#
#
# os.environ["ISC_USER"] = user_name
# os.environ["ISC_PASSWORD"] = user_password
#
#
# engine = str(db_conn.engine_version)
# db_conn.close()
#
#
# sql_cmd='''
# create table relations (
# relationid integer,
# relationname varchar(35)
# );
#
#
# create table categories (
# categoryid integer,
# description varchar(20)
# );
#
#
# create table relationcategories (
# relationid integer,
# categoryid integer
# );
# commit;
#
#
# insert into relations (relationid, relationname) values (1, 'diving snorkel shop');
# insert into relations (relationid, relationname) values (2, 'bakery garbage');
# insert into relations (relationid, relationname) values (3, 'racing turtle');
# insert into relations (relationid, relationname) values (4, 'folding air-hook shop');
#
#
# insert into categories (categoryid, description) values (1, 'relation');
# insert into categories (categoryid, description) values (2, 'debtor');
# insert into categories (categoryid, description) values (3, 'creditor');
# insert into categories (categoryid, description) values (4, 'newsletter');
#
#
# insert into relationcategories (relationid, categoryid) values (1, 1);
# insert into relationcategories (relationid, categoryid) values (2, 1);
# insert into relationcategories (relationid, categoryid) values (3, 1);
@ -74,7 +117,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# insert into relationcategories (relationid, categoryid) values (2, 2);
# insert into relationcategories (relationid, categoryid) values (1, 3);
# commit;
#
#
# -- Normally these indexes are created by the primary/foreign keys,
# -- but we don't want to rely on them for this test
# create unique asc index pk_relations on relations (relationid);
@ -83,7 +126,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# create asc index fk_rc_relations on relationcategories (relationid);
# create asc index fk_rc_categories on relationcategories (categoryid);
# commit;
#
#
# set plan on;
# -- set list on;
# -- FULL JOIN should return ...
@ -101,20 +144,20 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# ,rc.categoryid
# ,c.description
# ;
# '''
# '''
# f_sql=open( os.path.join(context['temp_directory'],'tmp_opt_full_join_01.tmp'), 'w')
# f_sql.write(sql_cmd)
# f_sql.close()
#
#
# f_log = open( os.path.join(context['temp_directory'],'tmp_opt_full_join_01.log'), 'w')
#
#
# subprocess.call( [ context['isql_path'], dsn, "-i", f_sql.name],
# stdout=f_log,
# stderr=subprocess.STDOUT
# )
# f_log.close()
# time.sleep(1)
#
#
# plan_25 = 'PLAN SORT (JOIN (C NATURAL, JOIN (RC NATURAL, R NATURAL)))'
# plan_30 = 'PLAN SORT (JOIN (JOIN (C NATURAL, JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS))), C NATURAL)))'
# with open(f_log.name) as f:
@ -124,7 +167,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# plan_expected=plan_25
# else:
# plan_expected=plan_30
#
#
# # Remove trailing whitespaces and newline character:
# if line.upper().rstrip() == plan_expected:
# print( 'Actual plan plan coincides with the expected.' )
@ -132,16 +175,38 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# print( 'Actual plan: '+line+' - differs from expected: '+plan_expected)
# else:
# print(line )
#
#
# os.remove(f_log.name)
# os.remove(f_sql.name)
#
#
#
#
#---
#act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
test_script_1 = """
set plan on;
-- set list on;
-- FULL JOIN should return ...
select
r.relationname,
rc.relationid,
rc.categoryid,
c.description
from relations r
full join relationcategories rc on (rc.relationid = r.relationid)
full join categories c on (c.categoryid = rc.categoryid)
order by
rc.relationid desc
,r.relationname
,rc.categoryid
,c.description
;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
Actual plan plan coincides with the expected.
PLAN SORT (JOIN (JOIN (C NATURAL, JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS))), C NATURAL)))
RELATIONNAME RELATIONID CATEGORYID DESCRIPTION
=================================== ============ ============ =============
racing turtle 3 1 relation
@ -152,11 +217,12 @@ expected_stdout_1 = """
diving snorkel shop 1 3 creditor
<null> <null> <null> newsletter
folding air-hook shop <null> <null> <null>
"""
"""
@pytest.mark.version('>=2.5')
@pytest.mark.xfail
def test_1(db_1):
pytest.fail("Test not IMPLEMENTED")
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -2,18 +2,18 @@
#
# id: functional.arno.optimizer.opt_full_join_02
# title: FULL OUTER JOIN, list all values, but filtered in WHERE clause
# decription:
# decription:
# TableX FULL OUTER JOIN TableY with relation in the ON clause.
# Three tables are used, where 1 table (RC) holds references to the two other tables (R and C).
# Three tables are used, where 1 table (RC) holds references to the two other tables (R and C).
# The two tables R and C contain both 1 value that isn't inside RC.
# =====
# Refactored 01-mar-2016. Checked on: WI-V2.5.6.26970, WI-V3.0.0.32366
#
#
# 27.12.2020: added 'rc.categoryid' to 'order by' list in order to have always stable sort result.
# Mismatch with expected result due to different position of records with the same 'rc.relationid'
# occured on 4.0.0.2298. CHecked on 4.0.0.2303.
#
# tracker_id:
#
# tracker_id:
# min_versions: ['2.5.0']
# versions: 2.5
# qmid: functional.arno.optimizer.opt_full_join_02
@ -26,50 +26,93 @@ from firebird.qa import db_factory, isql_act, Action
substitutions_1 = [('=', ''), ('[ \t]+', ' ')]
init_script_1 = """"""
init_script_1 = """
create table relations (
relationid integer,
relationname varchar(35)
);
create table categories (
categoryid integer,
description varchar(20)
);
create table relationcategories (
relationid integer,
categoryid integer
);
commit;
insert into relations (relationid, relationname) values (1, 'diving snorkel shop');
insert into relations (relationid, relationname) values (2, 'bakery garbage');
insert into relations (relationid, relationname) values (3, 'racing turtle');
insert into relations (relationid, relationname) values (4, 'folding air-hook shop');
insert into categories (categoryid, description) values (1, 'relation');
insert into categories (categoryid, description) values (2, 'debtor');
insert into categories (categoryid, description) values (3, 'creditor');
insert into categories (categoryid, description) values (4, 'newsletter');
insert into relationcategories (relationid, categoryid) values (1, 1);
insert into relationcategories (relationid, categoryid) values (2, 1);
insert into relationcategories (relationid, categoryid) values (3, 1);
insert into relationcategories (relationid, categoryid) values (1, 2);
insert into relationcategories (relationid, categoryid) values (2, 2);
insert into relationcategories (relationid, categoryid) values (1, 3);
commit;
-- normally these indexes are created by the primary/foreign keys,
-- but we don't want to rely on them for this test
create unique asc index pk_relations on relations (relationid);
create unique asc index pk_categories on categories (categoryid);
create unique asc index pk_relationcategories on relationcategories (relationid, categoryid);
create asc index fk_rc_relations on relationcategories (relationid);
create asc index fk_rc_categories on relationcategories (categoryid);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
#
#
# import os
# import sys
# import time
# import subprocess
#
#
# os.environ["ISC_USER"] = user_name
# os.environ["ISC_PASSWORD"] = user_password
# engine = str(db_conn.engine_version)
# db_conn.close()
#
#
# sql_cmd='''
# create table relations (
# relationid integer,
# relationname varchar(35)
# );
#
#
# create table categories (
# categoryid integer,
# description varchar(20)
# );
#
#
# create table relationcategories (
# relationid integer,
# categoryid integer
# );
# commit;
#
#
# insert into relations (relationid, relationname) values (1, 'diving snorkel shop');
# insert into relations (relationid, relationname) values (2, 'bakery garbage');
# insert into relations (relationid, relationname) values (3, 'racing turtle');
# insert into relations (relationid, relationname) values (4, 'folding air-hook shop');
#
#
# insert into categories (categoryid, description) values (1, 'relation');
# insert into categories (categoryid, description) values (2, 'debtor');
# insert into categories (categoryid, description) values (3, 'creditor');
# insert into categories (categoryid, description) values (4, 'newsletter');
#
#
# insert into relationcategories (relationid, categoryid) values (1, 1);
# insert into relationcategories (relationid, categoryid) values (2, 1);
# insert into relationcategories (relationid, categoryid) values (3, 1);
@ -77,7 +120,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# insert into relationcategories (relationid, categoryid) values (2, 2);
# insert into relationcategories (relationid, categoryid) values (1, 3);
# commit;
#
#
# -- normally these indexes are created by the primary/foreign keys,
# -- but we don't want to rely on them for this test
# create unique asc index pk_relations on relations (relationid);
@ -86,10 +129,10 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# create asc index fk_rc_relations on relationcategories (relationid);
# create asc index fk_rc_categories on relationcategories (categoryid);
# commit;
#
#
# set plan on;
# --set list on;
#
#
# --full join should return ...
# select
# r.relationname,
@ -107,20 +150,20 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# ,rc.categoryid
# ;
# '''
#
#
# f_sql=open( os.path.join(context['temp_directory'],'tmp_opt_full_join_02.tmp'), 'w')
# f_sql.write(sql_cmd)
# f_sql.close()
#
#
# f_log = open( os.path.join(context['temp_directory'],'tmp_opt_full_join_02.log'), 'w')
#
#
# subprocess.call( [context['isql_path'], dsn, "-i", f_sql.name],
# stdout=f_log,
# stderr=subprocess.STDOUT
# )
# f_log.close()
# time.sleep(1)
#
#
# plan_25 = 'PLAN SORT (JOIN (C NATURAL, JOIN (RC NATURAL, R INDEX (PK_RELATIONS))))'
# plan_30 = 'PLAN SORT (JOIN (JOIN (C NATURAL, JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R INDEX (PK_RELATIONS), RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R INDEX (PK_RELATIONS), RC INDEX (FK_RC_RELATIONS))), C NATURAL)))'
# with open(f_log.name) as f:
@ -130,7 +173,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# plan_expected=plan_25
# else:
# plan_expected=plan_30
#
#
# # Remove trailing whitespaces and newline character:
# if line.upper().rstrip() == plan_expected:
# print( 'Actual plan plan coincides with the expected.' )
@ -138,30 +181,52 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# print( 'Actual plan: '+line+' - differs from expected: '+plan_expected)
# else:
# print(line )
#
#
# # Cleanup
# #########
# os.remove(f_log.name)
# os.remove(f_sql.name)
#
#
#
#
#---
#act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
test_script_1 = """
set plan on;
--set list on;
--full join should return ...
select
r.relationname,
rc.relationid,
rc.categoryid,
c.description
from
relations r
full join relationcategories rc on (rc.relationid = r.relationid)
full join categories c on (c.categoryid = rc.categoryid)
where
r.relationid >= 2
order by
rc.relationid desc
,rc.categoryid
;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
Actual plan plan coincides with the expected.
PLAN SORT (JOIN (JOIN (C NATURAL, JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R INDEX (PK_RELATIONS), RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R INDEX (PK_RELATIONS), RC INDEX (FK_RC_RELATIONS))), C NATURAL)))
RELATIONNAME RELATIONID CATEGORYID DESCRIPTION
=================================== ============ ============ ============
racing turtle 3 1 relation
bakery garbage 2 1 relation
bakery garbage 2 2 debtor
folding air-hook shop <null> <null> <null>
"""
@pytest.mark.version('>=2.5')
@pytest.mark.xfail
def test_1(db_1):
pytest.fail("Test not IMPLEMENTED")
folding air-hook shop <null> <null> <null>
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -2,14 +2,14 @@
#
# id: functional.arno.optimizer.opt_full_join_03
# title: FULL OUTER JOIN, list all values, but filtered in WHERE clause
# decription:
# decription:
# TableX FULL OUTER JOIN TableY with relation in the ON clause.
# Three tables are used, where 1 table (RC) holds references to the two other tables (R and C).
# Three tables are used, where 1 table (RC) holds references to the two other tables (R and C).
# The two tables R and C contain both 1 value that isn't inside RC.
# =====
# Refactored 01-mar-2016. Checked on: WI-V2.5.6.26970, WI-V3.0.0.32366
#
# tracker_id:
#
# tracker_id:
# min_versions: ['2.5.0']
# versions: 2.5
# qmid: functional.arno.optimizer.opt_full_join_03
@ -22,59 +22,104 @@ from firebird.qa import db_factory, isql_act, Action
substitutions_1 = []
init_script_1 = """"""
init_script_1 = """
create table relations (
relationid integer,
relationname varchar(35)
);
create table categories (
categoryid integer,
description varchar(20)
);
create table relationcategories (
relationid integer,
categoryid integer
);
commit;
insert into relations (relationid, relationname) values (1, 'diving snorkel shop');
insert into relations (relationid, relationname) values (2, 'bakery garbage');
insert into relations (relationid, relationname) values (3, 'racing turtle');
insert into relations (relationid, relationname) values (4, 'folding air-hook shop');
insert into categories (categoryid, description) values (1, 'relation');
insert into categories (categoryid, description) values (2, 'debtor');
insert into categories (categoryid, description) values (3, 'creditor');
insert into categories (categoryid, description) values (4, 'newsletter');
insert into relationcategories (relationid, categoryid) values (1, 1);
insert into relationcategories (relationid, categoryid) values (2, 1);
insert into relationcategories (relationid, categoryid) values (3, 1);
insert into relationcategories (relationid, categoryid) values (1, 2);
insert into relationcategories (relationid, categoryid) values (2, 2);
insert into relationcategories (relationid, categoryid) values (1, 3);
commit;
-- Normally these indexes are created by the primary/foreign keys,
-- but we don't want to rely on them for this test
create unique asc index pk_relations on relations (relationid);
create unique asc index pk_categories on categories (categoryid);
create unique asc index pk_relationcategories on relationcategories (relationid, categoryid);
create asc index fk_rc_relations on relationcategories (relationid);
create asc index fk_rc_categories on relationcategories (categoryid);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
#
#
# import os
# import sys
# import time
# import subprocess
#
#
# os.environ["ISC_USER"] = user_name
# os.environ["ISC_PASSWORD"] = user_password
# engine = str(db_conn.engine_version)
# db_conn.close()
#
#
# sql_cmd='''
# create table relations (
# relationid integer,
# relationname varchar(35)
# );
#
#
# create table categories (
# categoryid integer,
# description varchar(20)
# );
#
#
# create table relationcategories (
# relationid integer,
# categoryid integer
# );
# commit;
#
#
# insert into relations (relationid, relationname) values (1, 'diving snorkel shop');
# insert into relations (relationid, relationname) values (2, 'bakery garbage');
# insert into relations (relationid, relationname) values (3, 'racing turtle');
# insert into relations (relationid, relationname) values (4, 'folding air-hook shop');
#
#
# insert into categories (categoryid, description) values (1, 'relation');
# insert into categories (categoryid, description) values (2, 'debtor');
# insert into categories (categoryid, description) values (3, 'creditor');
# insert into categories (categoryid, description) values (4, 'newsletter');
#
#
# insert into relationcategories (relationid, categoryid) values (1, 1);
# insert into relationcategories (relationid, categoryid) values (2, 1);
# insert into relationcategories (relationid, categoryid) values (3, 1);
# insert into relationcategories (relationid, categoryid) values (1, 2);
# insert into relationcategories (relationid, categoryid) values (2, 2);
# insert into relationcategories (relationid, categoryid) values (1, 3);
#
#
# commit;
#
#
# -- Normally these indexes are created by the primary/foreign keys,
# -- but we don't want to rely on them for this test
# create unique asc index pk_relations on relations (relationid);
@ -82,10 +127,10 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# create unique asc index pk_relationcategories on relationcategories (relationid, categoryid);
# create asc index fk_rc_relations on relationcategories (relationid);
# create asc index fk_rc_categories on relationcategories (categoryid);
#
#
# commit;
#
#
#
#
# set plan on;
# set list on;
# -- full join should return ...
@ -103,20 +148,20 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# order by
# rc.categoryid desc;
# '''
#
#
# f_sql=open( os.path.join(context['temp_directory'],'tmp_opt_full_join_03.tmp'), 'w')
# f_sql.write(sql_cmd)
# f_sql.close()
#
#
# f_log = open( os.path.join(context['temp_directory'],'tmp_opt_full_join_03.log'), 'w')
#
#
# subprocess.call( [context['isql_path'], dsn, "-i", f_sql.name],
# stdout=f_log,
# stderr=subprocess.STDOUT
# )
# f_log.close()
# time.sleep(1)
#
#
# plan_25 = 'PLAN SORT (JOIN (C INDEX (PK_CATEGORIES), JOIN (RC NATURAL, R NATURAL)))'
# plan_30 = 'PLAN SORT (JOIN (JOIN (C INDEX (PK_CATEGORIES), JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS))), C INDEX (PK_CATEGORIES))))'
# with open(f_log.name) as f:
@ -126,7 +171,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# plan_expected=plan_25
# else:
# plan_expected=plan_30
#
#
# # Remove trailing whitespaces and newline character:
# if line.upper().rstrip() == plan_expected:
# print( 'Actual plan plan coincides with the expected.' )
@ -134,18 +179,38 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# print( 'Actual plan: '+line+' - differs from expected: '+plan_expected)
# else:
# print(line )
#
#
# # Cleanup
# #########
# os.remove(f_log.name)
# os.remove(f_sql.name)
#
#
#
#
#---
#act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
test_script_1 = """
set plan on;
set list on;
-- full join should return ...
select
r.relationname,
rc.relationid,
rc.categoryid,
c.description
from
relations r
full join relationcategories rc on (rc.relationid = r.relationid)
full join categories c on (c.categoryid = rc.categoryid)
where
c.categoryid >= 2
order by
rc.categoryid desc;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
Actual plan plan coincides with the expected.
PLAN SORT (JOIN (JOIN (C INDEX (PK_CATEGORIES), JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS))), C INDEX (PK_CATEGORIES))))
RELATIONNAME diving snorkel shop
RELATIONID 1
@ -163,11 +228,10 @@ expected_stdout_1 = """
RELATIONID <null>
CATEGORYID <null>
DESCRIPTION newsletter
"""
@pytest.mark.version('>=2.5')
@pytest.mark.xfail
def test_1(db_1):
pytest.fail("Test not IMPLEMENTED")
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -2,7 +2,7 @@
#
# id: functional.arno.optimizer.opt_full_join_04
# title: FULL OUTER JOIN, list all values, but filtered in WHERE clause
# decription:
# decription:
# TableX FULL OUTER JOIN TableY with relation in the ON clause.
# Three tables are used, where 1 table (RC) holds references to the two other tables (R and C).
# The two tables R and C contain both 1 value that isn't inside RC.
@ -10,8 +10,8 @@
# NB: 'UNION ALL' is used here, so PLAN for 2.5 will be of TWO separate rows.
# =====
# Refactored 01-mar-2016. Checked on: WI-V2.5.6.26970, WI-V3.0.0.32366
#
# tracker_id:
#
# tracker_id:
# min_versions: ['2.5.0']
# versions: 2.5
# qmid: functional.arno.optimizer.opt_full_join_04
@ -24,60 +24,106 @@ from firebird.qa import db_factory, isql_act, Action
substitutions_1 = []
init_script_1 = """"""
init_script_1 = """
create table relations (
relationid integer,
relationname varchar(35)
);
create table categories (
categoryid integer,
description varchar(20)
);
create table relationcategories (
relationid integer,
categoryid integer
);
commit;
insert into relations (relationid, relationname) values (1, 'diving snorkel shop');
insert into relations (relationid, relationname) values (2, 'bakery garbage');
insert into relations (relationid, relationname) values (3, 'racing turtle');
insert into relations (relationid, relationname) values (4, 'folding air-hook shop');
insert into categories (categoryid, description) values (1, 'relation');
insert into categories (categoryid, description) values (2, 'debtor');
insert into categories (categoryid, description) values (3, 'creditor');
insert into categories (categoryid, description) values (4, 'newsletter');
insert into relationcategories (relationid, categoryid) values (1, 1);
insert into relationcategories (relationid, categoryid) values (2, 1);
insert into relationcategories (relationid, categoryid) values (3, 1);
insert into relationcategories (relationid, categoryid) values (1, 2);
insert into relationcategories (relationid, categoryid) values (2, 2);
insert into relationcategories (relationid, categoryid) values (1, 3);
commit;
-- normally these indexes are created by the primary/foreign keys,
-- but we don't want to rely on them for this test
create unique asc index pk_relations on relations (relationid);
create unique asc index pk_categories on categories (categoryid);
create unique asc index pk_relationcategories on relationcategories (relationid, categoryid);
create asc index fk_rc_relations on relationcategories (relationid);
create asc index fk_rc_categories on relationcategories (categoryid);
commit;
"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
#
#
# import os
# import sys
# import time
# import subprocess
#
#
# os.environ["ISC_USER"] = user_name
# os.environ["ISC_PASSWORD"] = user_password
# engine = str(db_conn.engine_version)
# db_conn.close()
#
#
# sql_cmd='''
# create table relations (
# relationid integer,
# relationname varchar(35)
# );
#
#
# create table categories (
# categoryid integer,
# description varchar(20)
# );
#
#
# create table relationcategories (
# relationid integer,
# categoryid integer
# );
#
#
# commit;
#
#
# insert into relations (relationid, relationname) values (1, 'diving snorkel shop');
# insert into relations (relationid, relationname) values (2, 'bakery garbage');
# insert into relations (relationid, relationname) values (3, 'racing turtle');
# insert into relations (relationid, relationname) values (4, 'folding air-hook shop');
#
#
# insert into categories (categoryid, description) values (1, 'relation');
# insert into categories (categoryid, description) values (2, 'debtor');
# insert into categories (categoryid, description) values (3, 'creditor');
# insert into categories (categoryid, description) values (4, 'newsletter');
#
#
# insert into relationcategories (relationid, categoryid) values (1, 1);
# insert into relationcategories (relationid, categoryid) values (2, 1);
# insert into relationcategories (relationid, categoryid) values (3, 1);
# insert into relationcategories (relationid, categoryid) values (1, 2);
# insert into relationcategories (relationid, categoryid) values (2, 2);
# insert into relationcategories (relationid, categoryid) values (1, 3);
#
#
# commit;
#
#
# -- normally these indexes are created by the primary/foreign keys,
# -- but we don't want to rely on them for this test
# create unique asc index pk_relations on relations (relationid);
@ -85,12 +131,12 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# create unique asc index pk_relationcategories on relationcategories (relationid, categoryid);
# create asc index fk_rc_relations on relationcategories (relationid);
# create asc index fk_rc_categories on relationcategories (categoryid);
#
#
# commit;
#
#
# set plan on;
# set list on;
#
#
# select
# r.relationname,
# rc.relationid,
@ -102,9 +148,9 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# full join categories c on (c.categoryid = rc.categoryid)
# where
# rc.categoryid is null and c.categoryid >= 1
#
#
# UNION ALL --- ::::::: U N I O N A L L :::::::
#
#
# select
# r.relationname,
# rc.relationid,
@ -117,28 +163,28 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# where
# rc.relationid is null and r.relationid >= 1;
# '''
#
#
# f_sql=open( os.path.join(context['temp_directory'],'tmp_opt_full_join_04.tmp'), 'w')
# f_sql.write(sql_cmd)
# f_sql.close()
#
#
# f_log = open( os.path.join(context['temp_directory'],'tmp_opt_full_join_04.log'), 'w')
#
#
# subprocess.call( [context['isql_path'], dsn, "-i", f_sql.name],
# stdout=f_log,
# stderr=subprocess.STDOUT
# )
# f_log.close()
# time.sleep(1)
#
#
# # NB: plan for 2.5 contains TWO rows!
# plan_25_1 = 'PLAN JOIN (C NATURAL, JOIN (RC NATURAL, R INDEX (PK_RELATIONS)))'
# plan_25_2 = 'PLAN JOIN (C INDEX (PK_CATEGORIES), JOIN (RC NATURAL, R NATURAL))'
#
#
# # plan for 3.0 contains only ONE row:
# plan_30_1 = 'PLAN (JOIN (JOIN (C INDEX (PK_CATEGORIES), JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS))), C INDEX (PK_CATEGORIES))), JOIN (JOIN (C NATURAL, JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R INDEX (PK_RELATIONS), RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R INDEX (PK_RELATIONS), RC INDEX (FK_RC_RELATIONS))), C NATURAL)))'
# plan_30_2 = ''
#
#
# with open(f_log.name) as f:
# for line in f:
# if line.upper().startswith('PLAN '):
@ -148,7 +194,7 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# else:
# plan_expected_1=plan_30_1
# plan_expected_2=plan_30_2
#
#
# # Remove trailing whitespaces and newline character:
# if line.upper().rstrip() == plan_expected_1 or line.upper().rstrip() == plan_expected_2:
# if line.upper().rstrip() == plan_expected_1:
@ -157,18 +203,50 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
# print( 'Actual plan: '+line+' - differs from expected: '+plan_expected)
# else:
# print(line )
#
#
# # Cleanup
# #########
# os.remove(f_log.name)
# os.remove(f_sql.name)
#
#
#
#
#---
#act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
test_script_1 = """
set plan on;
set list on;
select
r.relationname,
rc.relationid,
rc.categoryid,
c.description
from
relations r
full join relationcategories rc on (rc.relationid = r.relationid)
full join categories c on (c.categoryid = rc.categoryid)
where
rc.categoryid is null and c.categoryid >= 1
UNION ALL --- ::::::: U N I O N A L L :::::::
select
r.relationname,
rc.relationid,
rc.categoryid,
c.description
from
relations r
full join relationcategories rc on (rc.relationid = r.relationid)
full join categories c on (c.categoryid = rc.categoryid)
where
rc.relationid is null and r.relationid >= 1;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
Actual plan plan coincides with the expected.
PLAN (JOIN (JOIN (C INDEX (PK_CATEGORIES), JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R NATURAL, RC INDEX (FK_RC_RELATIONS))), C INDEX (PK_CATEGORIES))), JOIN (JOIN (C NATURAL, JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R INDEX (PK_RELATIONS), RC INDEX (FK_RC_RELATIONS)))), JOIN (JOIN (JOIN (RC NATURAL, R INDEX (PK_RELATIONS)), JOIN (R INDEX (PK_RELATIONS), RC INDEX (FK_RC_RELATIONS))), C NATURAL)))
RELATIONNAME <null>
RELATIONID <null>
@ -178,11 +256,10 @@ expected_stdout_1 = """
RELATIONID <null>
CATEGORYID <null>
DESCRIPTION <null>
"""
@pytest.mark.version('>=2.5')
@pytest.mark.xfail
def test_1(db_1):
pytest.fail("Test not IMPLEMENTED")
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -72,8 +72,7 @@ SELECT
Count(*)
FROM
Table_100 t100
JOIN Table_10 t10 ON (t10.ID = t100.ID);
"""
JOIN Table_10 t10 ON (t10.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -82,12 +81,11 @@ expected_stdout_1 = """PLAN JOIN (T10 NATURAL, T100 INDEX (PK_TABLE_100))
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -94,8 +94,7 @@ SELECT
FROM
Table_3K t3K
JOIN Table_100 t100 ON (t100.ID = t3K.ID)
JOIN Table_10 t10 ON (t10.ID = t100.ID);
"""
JOIN Table_10 t10 ON (t10.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -104,12 +103,11 @@ expected_stdout_1 = """PLAN JOIN (T10 NATURAL, T100 INDEX (PK_TABLE_100), T3K IN
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -2,13 +2,13 @@
#
# id: functional.arno.optimizer.opt_inner_join_03
# title: INNER JOIN join order
# decription:
# With a INNER JOIN the relation with the smallest expected result should be the first one in process order.
# The next relation should be the next relation with expected smallest result based on previous relation
# decription:
# With a INNER JOIN the relation with the smallest expected result should be the first one in process order.
# The next relation should be the next relation with expected smallest result based on previous relation
# and do on till last relation.
# Before 2.0, Firebird did stop checking order possibilties above 7 relations.
#
# tracker_id:
#
# tracker_id:
# min_versions: []
# versions: 2.0
# qmid: functional.arno.optimizer.opt_inner_join_03
@ -113,35 +113,20 @@ FROM
JOIN Table_4K t4K ON (t4K.ID = t3K.ID)
JOIN Table_1K t1K ON (t1K.ID = t4K.ID)
JOIN Table_2K t2K ON (t2K.ID = t1K.ID)
JOIN Table_1 t1 ON (t1.ID = t2K.ID);
"""
JOIN Table_1 t1 ON (t1.ID = t2K.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """PLAN JOIN (T1 NATURAL, T1K INDEX (PK_TABLE_1K), T2K INDEX (PK_TABLE_2K), T3K INDEX (PK_TABLE_3K), T5K INDEX (PK_TABLE_5K), T4K INDEX (PK_TABLE_4K), T6K INDEX (PK_TABLE_6K), T8K INDEX (PK_TABLE_8K), T10K INDEX (PK_TABLE_10K))
expected_stdout_1 = """PLAN JOIN (T1 NATURAL, T1K INDEX (PK_TABLE_1K), T2K INDEX (PK_TABLE_2K), T3K INDEX (PK_TABLE_3K), T4K INDEX (PK_TABLE_4K), T5K INDEX (PK_TABLE_5K), T6K INDEX (PK_TABLE_6K), T8K INDEX (PK_TABLE_8K), T10K INDEX (PK_TABLE_10K))
COUNT
=====================
1
"""
COUNT
============
@pytest.mark.version('>=2.0,<4')
1"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
expected_stdout_2 = """PLAN JOIN (T1 NATURAL, T1K INDEX (PK_TABLE_1K), T2K INDEX (PK_TABLE_2K), T3K INDEX (PK_TABLE_3K), T4K INDEX (PK_TABLE_4K), T5K INDEX (PK_TABLE_5K), T6K INDEX (PK_TABLE_6K), T8K INDEX (PK_TABLE_8K), T10K INDEX (PK_TABLE_10K))
COUNT
=====================
1
"""
@pytest.mark.version('>=4')
def test_1(act_1: Action):
act_1.charset = 'NONE'
act_1.expected_stdout = expected_stdout_2
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -312,7 +312,7 @@ FROM
RELATIONS r
JOIN COUNTRIES c ON (c.COUNTRYID = r.COUNTRYID)
WHERE
c.COUNTRYID IS NULL;"""
c.COUNTRYID IS NULL;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -321,12 +321,11 @@ expected_stdout_1 = """PLAN JOIN (C INDEX (PK_COUNTRIES), R INDEX (FK_RELATIONS_
COUNT
=====================
0
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -314,8 +314,7 @@ FROM
WHERE
c.CountryName LIKE 'N%'
ORDER BY
r.RelationName DESC;
"""
r.RelationName DESC;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -326,12 +325,11 @@ RELATIONNAME COUNTRYNAME
University Leiden NETHERLANDS
University Delft NETHERLANDS
University Amsterdam NETHERLANDS
"""
University Amsterdam NETHERLANDS"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -91,8 +91,7 @@ SELECT
Count(*)
FROM
View_100 v100
JOIN View_10 v10 ON (v10.ID = v100.ID);
"""
JOIN View_10 v10 ON (v10.ID = v100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -101,12 +100,11 @@ expected_stdout_1 = """PLAN JOIN (V10 TABLE_10 NATURAL, V100 TABLE_100 INDEX (PK
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -129,8 +129,7 @@ SELECT
Count(*)
FROM
View_B vb
JOIN View_A va ON (va.ID1K = vb.ID10K);
"""
JOIN View_A va ON (va.ID1K = vb.ID10K);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -140,12 +139,11 @@ expected_stdout_1 = """PLAN JOIN (VA T1K NATURAL, VB T3K INDEX (PK_TABLE_3K), VA
COUNT
============
1000
"""
1000"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -122,8 +122,7 @@ SELECT
Count(*)
FROM
View_B vb
JOIN View_A va ON (va.ID1 = vb.ID100);
"""
JOIN View_A va ON (va.ID1 = vb.ID100);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -132,12 +131,11 @@ expected_stdout_1 = """PLAN JOIN (JOIN (VA T1 NATURAL, VA T250 INDEX (PK_TABLE_2
COUNT
=====================
1
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -105,7 +105,6 @@ FROM
WHERE
t250.ID = t1.ID and
t100.ID = t1.ID;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -115,12 +114,11 @@ expected_stdout_1 = """PLAN JOIN (T1 NATURAL, T50 INDEX (PK_TABLE_50), T100 INDE
COUNT
============
1
"""
1"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -93,8 +93,7 @@ SELECT
FROM
Table_50 t50
JOIN Table_100 t100 ON (t100.ID = t50.ID)
JOIN Table_250 t250 ON (t250.ID = t100.ID);
"""
JOIN Table_250 t250 ON (t250.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -103,12 +102,11 @@ expected_stdout_1 = """PLAN JOIN (T50 NATURAL, T100 INDEX (PK_TABLE_100), T250 I
COUNT
============
50
"""
50"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -68,8 +68,7 @@ SELECT
Count(*)
FROM
Table_100 t100
JOIN Table_10 t10 ON (t10.ID = t100.ID);
"""
JOIN Table_10 t10 ON (t10.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -78,12 +77,11 @@ expected_stdout_1 = """PLAN HASH (T100 NATURAL, T10 NATURAL)
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -87,8 +87,7 @@ SELECT
FROM
Table_1000 t1000
JOIN Table_100 t100 ON (t100.ID = t1000.ID)
JOIN Table_10 t10 ON (t10.ID = t100.ID);
"""
JOIN Table_10 t10 ON (t10.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -97,12 +96,11 @@ expected_stdout_1 = """PLAN HASH (T1000 NATURAL, T100 NATURAL, T10 NATURAL)
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -68,8 +68,7 @@ SELECT
Count(*)
FROM
Table_100 t100
JOIN Table_10 t10 ON (t10.ID + (2 * 10) = t100.ID + 20);
"""
JOIN Table_10 t10 ON (t10.ID + (2 * 10) = t100.ID + 20);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -78,12 +77,11 @@ expected_stdout_1 = """PLAN HASH (T100 NATURAL, T10 NATURAL)
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -79,8 +79,7 @@ SELECT
Count(*)
FROM
Table_100 t100
JOIN Table_10 t10 ON (t10.ID = t100.ID);
"""
JOIN Table_10 t10 ON (t10.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -89,12 +88,11 @@ expected_stdout_1 = """PLAN HASH (T100 NATURAL, T10 NATURAL)
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -98,8 +98,7 @@ SELECT
Count(*)
FROM
Table_1000 t1000
JOIN View_A va ON (va.ID100 = t1000.ID);
"""
JOIN View_A va ON (va.ID100 = t1000.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -108,12 +107,11 @@ expected_stdout_1 = """PLAN HASH (T1000 NATURAL, VA T100 NATURAL, VA T10 NATURAL
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -84,8 +84,7 @@ SELECT
FROM
Table_100 t100
JOIN Table_10 t10 ON (t10.ID = t100.ID)
JOIN PR_List_1000 sp1000 ON (sp1000.ID = t10.ID);
"""
JOIN PR_List_1000 sp1000 ON (sp1000.ID = t10.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -94,12 +93,11 @@ expected_stdout_1 = """PLAN HASH (T100 NATURAL, T10 NATURAL, SP1000 NATURAL)
COUNT
=====================
5
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -59,8 +59,7 @@ SELECT
c.ColorName
FROM
Flowers f
LEFT JOIN Colors c ON (1 = 0);
"""
LEFT JOIN Colors c ON (1 = 0);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -71,12 +70,11 @@ FLOWERNAME COLORNAME
Rose <null>
Tulip <null>
Gerbera <null>
"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -62,8 +62,7 @@ FROM
Flowers f
LEFT JOIN Colors c ON (1 = 0)
WHERE
c.ColorID IS NULL;
"""
c.ColorID IS NULL;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -73,12 +72,11 @@ FLOWERNAME COLORNAME
Rose <null>
Tulip <null>
Gerbera <null>
"""
Gerbera <null>"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -62,7 +62,7 @@ FROM
Flowers f
LEFT JOIN Colors c ON (1 = 1)
WHERE
f.ColorID = c.ColorID;"""
f.ColorID = c.ColorID;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -72,12 +72,11 @@ FLOWERNAME COLORNAME
Rose Red
Tulip Yellow
Gerbera Not defined
"""
Gerbera Not defined"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -61,8 +61,7 @@ SELECT
c.ColorName
FROM
Flowers f
LEFT JOIN Colors c ON (c.ColorID = f.ColorID);
"""
LEFT JOIN Colors c ON (c.ColorID = f.ColorID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -72,12 +71,11 @@ FLOWERNAME COLORNAME
Rose Red
Tulip Yellow
Gerbera Not defined
"""
Gerbera Not defined"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -62,8 +62,7 @@ SELECT
FROM
Flowers f
LEFT JOIN Colors c ON ((c.ColorID = f.ColorID) AND
(c.ColorID >= 1));
"""
(c.ColorID >= 1));"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -79,5 +78,5 @@ Gerbera <null>"""
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -66,8 +66,7 @@ FROM
LEFT JOIN Colors c ON (c.ColorID = f1.ColorID) AND (c.ColorID > 0)
WHERE
(f2.ColorID = f1.ColorID) AND
(c.ColorID > 0);
"""
(c.ColorID > 0);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -77,12 +76,11 @@ FLOWERNAME FLOWERNAME COLORNAME
============================== ============================== ====================
Rose Rose Red
Tulip Tulip Yellow
"""
Tulip Tulip Yellow"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -63,8 +63,7 @@ FROM
Flowers f
JOIN Colors c1 ON (c1.ColorID = f.ColorID)
LEFT JOIN Colors c2 ON (c2.ColorID = c1.ColorID)
JOIN Colors c3 ON (c3.ColorID = c1.ColorID);
"""
JOIN Colors c3 ON (c3.ColorID = c1.ColorID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -75,12 +74,11 @@ expected_stdout_1 = """PLAN JOIN (JOIN (JOIN (F NATURAL, C1 INDEX (PK_COLORS)),
1 1 1 1
2 2 2 2
0 0 0 0
"""
0 0 0 0"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -62,8 +62,7 @@ FROM
LEFT JOIN Colors c ON (c.ColorID = f.ColorID) AND
(c.ColorID > 0)
WHERE
f.ColorID >= 0;
"""
f.ColorID >= 0;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -75,12 +74,11 @@ PLAN JOIN (F INDEX (FK_FLOWERS_COLORS), C INDEX (PK_COLORS))
1 1
2 2
0 <null>
"""
@pytest.mark.version('>=2.5')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -61,7 +61,7 @@ FROM
Flowers f
LEFT JOIN Colors c1 ON (c1.ColorID = f.ColorID) AND
(c1.ColorID >= 1)
JOIN Colors c2 ON (c2.ColorID = f.ColorID);"""
JOIN Colors c2 ON (c2.ColorID = f.ColorID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -72,12 +72,11 @@ expected_stdout_1 = """PLAN JOIN (JOIN (F NATURAL, C1 INDEX (PK_COLORS)), C2 IND
1 1 1
2 2 2
0 <null> 0
"""
0 <null> 0"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -62,8 +62,7 @@ FROM
Flowers f
LEFT JOIN Colors c ON (1 = 0)
WHERE
c.ColorID IS NULL or c.ColorID = 1;
"""
c.ColorID IS NULL or c.ColorID = 1;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -73,12 +72,11 @@ FLOWERNAME COLORNAME
Rose <null>
Tulip <null>
Gerbera <null>
"""
Gerbera <null>"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -72,17 +72,17 @@ test_script_1 = """
WHERE
c.ColorName STARTING WITH 'R' -- index I_Colors_Name exists for this field
;
"""
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
PLAN JOIN (F NATURAL, C INDEX (I_COLORS_NAME))
"""
"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -64,7 +64,7 @@ FROM
Flowers f
LEFT JOIN Colors c ON (c.ColorID = f.ColorID)
WHERE
CASE WHEN c.ColorID >= 0 THEN 0 ELSE 1 END = 1;"""
CASE WHEN c.ColorID >= 0 THEN 0 ELSE 1 END = 1;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -73,12 +73,11 @@ expected_stdout_1 = """PLAN JOIN (F NATURAL, C INDEX (PK_COLORS))
FLOWERNAME COLORNAME
============================== ====================
Blanc <null>
"""
Blanc <null>"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -71,8 +71,7 @@ SELECT
vc.ColorName
FROM
Flowers f
LEFT JOIN VW_Colors vc ON (vc.ColorID = f.ColorID);
"""
LEFT JOIN VW_Colors vc ON (vc.ColorID = f.ColorID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -82,12 +81,11 @@ FLOWERNAME COLORNAME
Rose Red
Tulip Yellow
Gerbera Not defined
"""
Gerbera Not defined"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -90,8 +90,7 @@ SELECT
FROM
Table_1000 t1000
JOIN Table_100 t100 ON (t100.ID = t1000.ID)
JOIN Table_10 t10 ON (t10.ID = t100.ID);
"""
JOIN Table_10 t10 ON (t10.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -100,12 +99,11 @@ expected_stdout_1 = """PLAN HASH (T1000 NATURAL, JOIN (T10 NATURAL, T100 INDEX (
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -90,8 +90,7 @@ SELECT
FROM
Table_1000 t1000
LEFT JOIN Table_100 t100 ON (t100.ID = t1000.ID)
JOIN Table_10 t10 ON (t10.ID = t100.ID);
"""
JOIN Table_10 t10 ON (t10.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -100,12 +99,11 @@ expected_stdout_1 = """PLAN HASH (T10 NATURAL, JOIN (T1000 NATURAL, T100 INDEX (
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -97,8 +97,7 @@ FROM
Table_10 t10
LEFT JOIN Table_1 t1 ON (t1.ID = t10.ID)
JOIN Table_1000 t1000 ON (t1000.ID = t10.ID)
JOIN Table_100 t100 ON (t100.ID = t1000.ID);
"""
JOIN Table_100 t100 ON (t100.ID = t1000.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -107,12 +106,11 @@ expected_stdout_1 = """PLAN HASH (T1000 NATURAL, JOIN (JOIN (T10 NATURAL, T1 IND
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -103,8 +103,7 @@ FROM
LEFT JOIN Table_1 t1 ON (t1.ID = t10.ID)
JOIN Table_100 t100 ON (t100.ID = t10.ID)
LEFT JOIN Table_50 t50 ON (t50.ID = t100.ID)
JOIN Table_1000 t1000 ON (t1000.ID = t100.ID);
"""
JOIN Table_1000 t1000 ON (t1000.ID = t100.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -113,12 +112,11 @@ expected_stdout_1 = """PLAN HASH (T1000 NATURAL, JOIN (HASH (T100 NATURAL, JOIN
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -110,8 +110,7 @@ FROM
JOIN Table_1000 t1000 ON (t1000.ID = t500.ID)
LEFT JOIN Table_10 t10 ON (t10.ID = t1000.ID)
JOIN Table_50 t50 ON (t50.ID = t10.ID)
JOIN Table_100 t100 ON (t100.ID = t500.ID);
"""
JOIN Table_100 t100 ON (t100.ID = t500.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -120,12 +119,11 @@ expected_stdout_1 = """PLAN HASH (T100 NATURAL, JOIN (JOIN (HASH (T1000 NATURAL,
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -109,8 +109,7 @@ FROM
JOIN Table_1000 t1000 ON (t1000.ID = t500.ID)
JOIN Table_10 t10 ON (t10.ID = t1000.ID)
JOIN Table_50 t50 ON (t50.ID = t10.ID)
JOIN Table_100 t100 ON (t100.ID = t500.ID);
"""
JOIN Table_100 t100 ON (t100.ID = t500.ID);"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -119,12 +118,11 @@ expected_stdout_1 = """PLAN HASH (T1000 NATURAL, T100 NATURAL, T10 NATURAL, JOIN
COUNT
=====================
10
"""
@pytest.mark.version('>=3.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -74,8 +74,7 @@ FROM
WHERE
st.F1 = 5 and
st.F2 = 50 and
st.F3 = 550;
"""
st.F3 = 550;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -84,12 +83,11 @@ expected_stdout_1 = """PLAN (ST INDEX (I_F1_F2_UNIQUE_ASC))
F1 F2 F3
============ ============ ============
5 50 550
"""
5 50 550"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -94,12 +94,11 @@ expected_stdout_1 = """PLAN (ST INDEX (I_F1_F2_ASC))
F1 F2 F3
============ ============ ============
150 0 150
"""
150 0 150"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -91,12 +91,11 @@ expected_stdout_1 = """PLAN (ST INDEX (I_F1_ASC))
F1 F2 F3
============ ============ ============
555 550 5
"""
555 550 5"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -73,8 +73,7 @@ FROM
WHERE
st.F1 >= 1 and
st.F2 = 100 and
st.F3 = 100;
"""
st.F3 = 100;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -83,12 +82,11 @@ expected_stdout_1 = """PLAN (ST INDEX (I_F3_F2_ASC))
F1 F2 F3
============ ============ ============
100 100 100
"""
100 100 100"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -79,8 +79,7 @@ FROM
WHERE
st.F1 >= 1 and
st.F2 = 100 and
st.F3 = 100;
"""
st.F3 = 100;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -89,12 +88,11 @@ expected_stdout_1 = """PLAN (ST INDEX (I_F3_F2_F1_ASC))
F1 F2 F3
============ ============ ============
100 100 100
"""
100 100 100"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -76,8 +76,7 @@ FROM
SelectionTest st
WHERE
st.F1 = 55 and
st.F2 IS NULL;
"""
st.F2 IS NULL;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -90,12 +89,11 @@ expected_stdout_1 = """PLAN (ST INDEX (I_F1_F2_ASC))
55 <null>
55 <null>
55 <null>
55 <null>
"""
55 <null>"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -69,8 +69,7 @@ FROM
SelectionTest st
WHERE
st.F1 = 100 and
st.F2 STARTING WITH '55';
"""
st.F2 STARTING WITH '55';"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -79,12 +78,11 @@ expected_stdout_1 = """PLAN (ST INDEX (I_F1_F2_ASC))
F1 F2
============ ==================
100 55
"""
100 55"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -85,8 +85,7 @@ FROM
WHERE
RDB$RELATION_NAME = 'SELECTIVITYTEST'
ORDER BY
RDB$INDEX_NAME;
"""
RDB$INDEX_NAME;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -100,12 +99,11 @@ I_F02_DESC 0.00200
I_F05_ASC 0.00498
I_F05_DESC 0.00498
I_F50_ASC 0.04762
I_F50_DESC 0.04762
"""
I_F50_DESC 0.04762"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

View File

@ -76,8 +76,7 @@ FROM
WHERE
RDB$RELATION_NAME = 'SELECTIVITYTEST'
ORDER BY
RDB$INDEX_NAME;
"""
RDB$INDEX_NAME;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
@ -91,12 +90,11 @@ I_F02_DESC 0.00200
I_F05_ASC 0.00498
I_F05_DESC 0.00498
I_F50_ASC 0.04762
I_F50_DESC 0.04762
"""
I_F50_DESC 0.04762"""
@pytest.mark.version('>=2.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
assert act_1.clean_stdout == act_1.clean_expected_stdout

Some files were not shown because too many files have changed in this diff Show More