2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
"""
|
|
|
|
ID: issue-2013
|
|
|
|
ISSUE: 2013
|
|
|
|
TITLE: Altering procedure parameters can lead to unrestorable database
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-1592
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_1592
|
2022-01-20 17:32:14 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set bail on;
|
|
|
|
set list on;
|
|
|
|
set term ^;
|
|
|
|
create or alter procedure p2 as begin end
|
|
|
|
^
|
|
|
|
commit
|
|
|
|
^
|
|
|
|
create or alter procedure p1 returns ( x1 integer ) as begin
|
|
|
|
x1 = 10; suspend;
|
2022-01-20 17:32:14 +01:00
|
|
|
end
|
2021-04-26 20:07:00 +02:00
|
|
|
^
|
|
|
|
create or alter procedure p2 returns ( x1 integer ) as begin
|
|
|
|
for select x1 from p1 into :x1 do suspend;
|
|
|
|
end
|
|
|
|
^
|
|
|
|
|
|
|
|
-- This should FAIL and terminate script execution:
|
|
|
|
alter procedure p1 returns ( x2 integer ) as begin
|
|
|
|
x2 = 10; suspend;
|
|
|
|
end
|
|
|
|
^
|
|
|
|
set term ;^
|
|
|
|
commit;
|
|
|
|
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
expected_stderr = """
|
2021-04-26 20:07:00 +02:00
|
|
|
Statement failed, SQLSTATE = 42000
|
|
|
|
unsuccessful metadata update
|
|
|
|
-cannot delete
|
|
|
|
-PARAMETER P1.X1
|
|
|
|
-there are 1 dependencies
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=4.0')
|
2022-01-20 17:32:14 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stderr = expected_stderr
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stderr == act.clean_expected_stderr
|
2021-04-26 20:07:00 +02:00
|
|
|
|