6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_4376_test.py

88 lines
2.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4698
ISSUE: 4698
TITLE: Preparation of erroneous DDL statement does not show the main command failed
DESCRIPTION:
JIRA: CORE-4376
FBTEST: bugs.core_4376
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
test_script = """
recreate table test1(id int, name varchar(30));
commit;
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
set term ^;
create or alter procedure sp_test(a_id int) returns (o_name varchar(30)) as
begin
select text from test where id = :a_id into o_name;
suspend;
end
^
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
create or alter package pkg_test as
begin
procedure sp_test1a(a_id int) returns (o_name varchar(30));
procedure sp_test1b(a_id int) returns (o_name varchar(30));
procedure sp_test1c(a_id int) returns (o_name varchar(30));
end
^
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
recreate package body pkg_test as
begin
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
procedure sp_test1a(a_id int) returns (o_name varchar(30)) as
begin
select name from test1 where id = :a_id into o_name;
suspend;
end
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
procedure sp_test1b(a_id int) returns (o_name varchar(30)) as
begin
select non_existent_field from test1 where id = :a_id into o_name;
suspend;
end
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
procedure sp_test1c(a_id int) returns (o_name varchar(30)) as
begin
select name from non_existent_table where id = :a_id into o_name;
suspend;
end
end
^
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
act = isql_act('db', test_script, substitutions=[('-At line[:]{0,1}[\\s]+[\\d]+,[\\s]+column[:]{0,1}[\\s]+[\\d]+', '')])
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stderr = """
2021-04-26 20:07:00 +02:00
Statement failed, SQLSTATE = 42S02
unsuccessful metadata update
-CREATE OR ALTER PROCEDURE SP_TEST failed
-Dynamic SQL Error
-SQL error code = -204
-Table unknown
-TEST
-At line 3, column 26
Statement failed, SQLSTATE = 42S22
unsuccessful metadata update
-RECREATE PACKAGE BODY PKG_TEST failed
-Dynamic SQL Error
-SQL error code = -206
-Column unknown
-NON_EXISTENT_FIELD
-At line 12, column 16
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-23 20:41:55 +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