From e389d9d0567bb8d923f843d3ab0cd9420ed4e049 Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Wed, 17 May 2023 10:25:36 +0300 Subject: [PATCH] Added/Updated tests\bugs\gh_7574_test.py: Confirmed problem on 5.0.0.1049. Checked on 5.0.0.1050 -- all fine. --- tests/bugs/gh_7574_test.py | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tests/bugs/gh_7574_test.py diff --git a/tests/bugs/gh_7574_test.py b/tests/bugs/gh_7574_test.py new file mode 100644 index 00000000..e59c6971 --- /dev/null +++ b/tests/bugs/gh_7574_test.py @@ -0,0 +1,59 @@ +#coding:utf-8 + +""" +ID: issue-7574 +ISSUE: https://github.com/FirebirdSQL/firebird/issues/7574 +TITLE: Derived table syntax allows dangling "AS" +NOTES: + [17.05.2023] pzotov + Confirmed problem on 5.0.0.1049. Checked on 5.0.0.1050 -- all fine. +""" + +import pytest +from firebird.qa import * + +db = db_factory() + +test_script = """ + set heading off; + -- All following statements must FAIL since 5.0.0.1050: + select i from (select 1 as i from rdb$database) as; + ------------------------------------- + with + a as + (select 2 as i from rdb$database) + select * from (select i from a) as + ; + ------------------------------------- + with recursive + r as ( + select 0 as i from rdb$database + UNION ALL + select r.i+1 as i from r where r.i < 3 + ) + select * from (select i from r) as + ; +""" + +act = isql_act('db', test_script, substitutions = [('line \\d+, column \\d+', '')]) + +expected_stdout = """ + Statement failed, SQLSTATE = 42000 + Dynamic SQL Error + -SQL error code = -104 + -Unexpected end of command - line 1, column 49 + Statement failed, SQLSTATE = 42000 + Dynamic SQL Error + -SQL error code = -104 + -Unexpected end of command - line 4, column 37 + Statement failed, SQLSTATE = 42000 + Dynamic SQL Error + -SQL error code = -104 + -Unexpected end of command - line 7, column 37 +""" + +@pytest.mark.version('>=5.0') +def test_1(act: Action): + act.expected_stdout = expected_stdout + act.execute(combine_output = True) + assert act.clean_stdout == act.clean_expected_stdout