|
2 | 2 |
|
3 | 3 | """
|
4 | 4 | ID: issue-4038
|
5 |
| -ISSUE: https://github.com/FirebirdSQL/firebird/issues/4038 |
| 5 | +ISSUE: 4038 |
6 | 6 | TITLE: Wrong warning message for ambiguous query
|
7 |
| -DESCRIPTION: SQL dialect 1 allows such queries for backward compatibility reasons |
| 7 | +DESCRIPTION: Check for dialect 3. |
8 | 8 | JIRA: CORE-3690
|
9 | 9 | FBTEST: bugs.core_3690
|
| 10 | +NOTES: |
| 11 | + [27.06.2025] pzotov |
| 12 | + Separated expected output for FB major versions prior/since 6.x. |
| 13 | + No substitutions are used to suppress schema and quotes. Discussed with dimitr, 24.06.2025 12:39. |
| 14 | +
|
| 15 | + Checked on 6.0.0.876; 5.0.3.1668; 4.0.6.3214; 3.0.13.33813. |
10 | 16 | """
|
11 | 17 |
|
12 | 18 | import pytest
|
13 | 19 | from firebird.qa import *
|
14 | 20 |
|
15 |
| -db_3 = db_factory(sql_dialect=3) |
| 21 | +db = db_factory() |
16 | 22 |
|
17 | 23 | test_script = """
|
18 | 24 | set list on;
|
19 | 25 | select m.mon$sql_dialect from mon$database m;
|
20 | 26 | select 0*rdb$relation_id as id from rdb$database,rdb$database;
|
21 | 27 | """
|
22 | 28 |
|
23 |
| -act_3 = python_act('db_3') |
24 |
| - |
25 |
| -expected_stdout_3 = """ |
26 |
| - MON$SQL_DIALECT 3 |
| 29 | +substitutions = [('[ \t]+', ' ')] |
| 30 | +act = python_act('db', substitutions = substitutions) |
27 | 31 |
|
| 32 | +expected_stdout_5x = """ |
| 33 | + MON$SQL_DIALECT 3 |
28 | 34 | Statement failed, SQLSTATE = 42702
|
29 | 35 | Dynamic SQL Error
|
30 | 36 | -SQL error code = -204
|
31 | 37 | -Ambiguous field name between table RDB$DATABASE and table RDB$DATABASE
|
32 | 38 | -RDB$RELATION_ID
|
33 | 39 | """
|
34 | 40 |
|
| 41 | +expected_stdout_6x = """ |
| 42 | + MON$SQL_DIALECT 3 |
| 43 | + Statement failed, SQLSTATE = 42702 |
| 44 | + Dynamic SQL Error |
| 45 | + -SQL error code = -204 |
| 46 | + -Ambiguous field name between table "SYSTEM"."RDB$DATABASE" and table "SYSTEM"."RDB$DATABASE" |
| 47 | + -RDB$RELATION_ID |
| 48 | +""" |
| 49 | + |
35 | 50 | @pytest.mark.version('>=3')
|
36 |
| -def test_dialect_3(act_3: Action): |
37 |
| - act_3.expected_stdout = expected_stdout_3 |
38 |
| - act_3.isql(switches=['-q', '-sql_dialect', '3'], input=test_script, combine_output=True) |
39 |
| - assert act_3.clean_stdout == act_3.clean_expected_stdout |
| 51 | +def test_1(act: Action): |
| 52 | + act.expected_stdout = expected_stdout_5x if act.is_version('<6') else expected_stdout_6x |
| 53 | + act.isql(switches=['-q'], input=test_script, combine_output=True) |
| 54 | + assert act.clean_stdout == act.clean_expected_stdout |
0 commit comments