#coding:utf-8 # # id: functional.arno.derived_tables.06 # title: Derived table 6 outer reference # decription: Outer reference inside derived table to other relations in from clause is not allowed. # tracker_id: # min_versions: [] # versions: 2.5.0 # qmid: functional.arno.derived_tables.derived_tables_06 import pytest from firebird.qa import db_factory, isql_act, Action # version: 2.5.0 # resources: None substitutions_1 = [('column.*', '')] init_script_1 = """CREATE TABLE Table_10 ( ID INTEGER NOT NULL, DESCRIPTION VARCHAR(10) ); COMMIT; INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (0, NULL); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (1, 'one'); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (2, 'two'); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (3, 'three'); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (4, 'four'); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (5, 'five'); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (6, 'six'); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (7, 'seven'); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (8, 'eight'); INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (9, 'nine'); COMMIT; """ db_1 = db_factory(sql_dialect=3, init=init_script_1) test_script_1 = """SELECT dt.* FROM Table_10 t10 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) expected_stderr_1 = """Statement failed, SQLSTATE = 42S22 Dynamic SQL Error -SQL error code = -206 -Column unknown -T10.ID -At line 5, column 53 """ @pytest.mark.version('>=2.5.0') def test_06_1(act_1: Action): act_1.expected_stderr = expected_stderr_1 act_1.execute() assert act_1.clean_expected_stderr == act_1.clean_stderr