6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/functional/arno/derived_tables/test_09.py

57 lines
1.5 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-28 18:56:36 +01:00
"""
ID: derived-table-09
TITLE: Outer reference inside derived table to other relations in from clause is not allowed
DESCRIPTION:
2022-02-04 19:05:19 +01:00
FBTEST: functional.arno.derived_tables.09
2022-01-28 18:56:36 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-28 18:56:36 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-28 18:56:36 +01:00
init_script = """CREATE TABLE Table_10 (
2021-04-26 20:07:00 +02:00
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;
"""
2022-01-28 18:56:36 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-28 18:56:36 +01:00
test_script = """SELECT
2021-04-26 20:07:00 +02:00
dt.*
FROM
Table_10 t10
FULL JOIN (SELECT * FROM Table_10 t2 WHERE t2.ID = t10.ID) dt ON (1 = 1);"""
2021-04-26 20:07:00 +02:00
2022-01-28 18:56:36 +01:00
act = isql_act('db', test_script, substitutions=[('column.*', '')])
2021-04-26 20:07:00 +02:00
2022-01-28 18:56:36 +01:00
expected_stderr = """Statement failed, SQLSTATE = 42S22
2021-04-26 20:07:00 +02:00
Dynamic SQL Error
-SQL error code = -206
-Column unknown
-T10.ID
-At line 5, column 58
"""
2022-01-28 18:56:36 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stderr = expected_stderr
act.execute()
assert act.clean_stderr == act.clean_expected_stderr