6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_3180_test.py

49 lines
1.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3554
ISSUE: 3554
TITLE: ALTER VIEW with not matched columns in declaration and selection crashs the server
DESCRIPTION:
JIRA: CORE-3180
FBTEST: bugs.core_3180
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
init_script = """create view TEST_VIEW (ID) as select 1 from rdb$database;
2021-04-26 20:07:00 +02:00
commit;"""
2022-01-22 21:59:15 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """alter view TEST_VIEW (ID) as select 1, 2 from rdb$database;
2021-04-26 20:07:00 +02:00
COMMIT;
SHOW VIEW TEST_VIEW;
"""
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """ID INTEGER Expression
2021-04-26 20:07:00 +02:00
View Source:
==== ======
select 1 from rdb$database
2022-01-22 21:59:15 +01:00
"""
expected_stderr = """Statement failed, SQLSTATE = 07002
2021-04-26 20:07:00 +02:00
unsuccessful metadata update
-ALTER VIEW TEST_VIEW failed
-SQL error code = -607
-Invalid command
-number of columns does not match select list
"""
@pytest.mark.version('>=3.0')
2022-01-22 21:59:15 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)
2021-04-26 20:07:00 +02:00