Skip to content

Commit c889f96

Browse files
committed
Add a test tests/functional/arno/derived_tables/test_27.py from fbtest.
1 parent 6f5894e commit c889f96

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: derived-table-27
5+
TITLE: Derived table with non-unique column aliases.
6+
DESCRIPTION: Expect an error if a derived table column aliases is not unique.
7+
FBTEST: functional.arno.derived_tables.30
8+
"""
9+
10+
import pytest
11+
from firebird.qa import *
12+
13+
init_script = """CREATE TABLE Table_10 (
14+
ID INTEGER NOT NULL,
15+
DESCRIPTION VARCHAR(10)
16+
);
17+
18+
COMMIT;
19+
20+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (0, NULL);
21+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (1, 'one');
22+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (2, 'two');
23+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (3, 'three');
24+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (4, 'four');
25+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (5, 'five');
26+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (6, 'six');
27+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (7, 'seven');
28+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (8, 'eight');
29+
INSERT INTO Table_10 (ID, DESCRIPTION) VALUES (9, 'nine');
30+
31+
COMMIT;"""
32+
33+
db = db_factory(init=init_script)
34+
35+
test_script = """SELECT
36+
dt.*
37+
FROM
38+
(SELECT * FROM Table_10 t10) dt (ID, ID);"""
39+
40+
act = isql_act('db', test_script)
41+
42+
expected_stderr = """
43+
Statement failed, SQLSTATE = 42000
44+
Dynamic SQL Error
45+
-SQL error code = -104
46+
-Invalid command
47+
-column ID was specified multiple times for derived table DT
48+
"""
49+
50+
@pytest.mark.version('>=3')
51+
def test_1(act: Action):
52+
act.expected_stderr = expected_stderr
53+
act.execute()
54+
assert act.clean_stderr == act.clean_expected_stderr

0 commit comments

Comments
 (0)