2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
|
|
|
ID: issue-4349
|
|
|
|
ISSUE: 4349
|
|
|
|
TITLE: Using system domain in procedures arguments/returns cause the proc to be unchangeable
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-4018
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_4018
|
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 = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set list on;
|
|
|
|
set blob all;
|
|
|
|
set count on;
|
|
|
|
|
|
|
|
set term ^;
|
|
|
|
create procedure sp_test returns(info rdb$source) as
|
|
|
|
begin
|
|
|
|
info = 'foo';
|
|
|
|
suspend;
|
|
|
|
end
|
|
|
|
^
|
|
|
|
set term ;^
|
|
|
|
commit;
|
2022-01-23 20:41:55 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
select 'point-1' as msg, rdb$parameter_name, rdb$parameter_type, rdb$field_source
|
2022-01-23 20:41:55 +01:00
|
|
|
from rdb$procedure_parameters
|
2021-04-26 20:07:00 +02:00
|
|
|
where rdb$procedure_name = upper('sp_test')
|
|
|
|
order by rdb$parameter_name, rdb$parameter_type;
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
select 'point-2' as msg, rdb$procedure_source
|
|
|
|
from rdb$procedures
|
2021-04-26 20:07:00 +02:00
|
|
|
where rdb$procedure_name = upper('sp_test');
|
|
|
|
commit;
|
|
|
|
|
|
|
|
set term ^;
|
|
|
|
alter procedure sp_test(whoami rdb$user) returns(memo_info rdb$description) as
|
|
|
|
begin
|
|
|
|
memo_info = 'bar';
|
|
|
|
suspend;
|
|
|
|
end
|
|
|
|
^
|
|
|
|
set term ;^
|
|
|
|
commit;
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
select 'point-3' as msg, rdb$parameter_name, rdb$parameter_type, rdb$field_source
|
|
|
|
from rdb$procedure_parameters
|
2021-04-26 20:07:00 +02:00
|
|
|
where rdb$procedure_name = upper('sp_test')
|
|
|
|
order by rdb$parameter_name, rdb$parameter_type;
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
select 'point-4' as msg, rdb$procedure_source
|
|
|
|
from rdb$procedures
|
2021-04-26 20:07:00 +02:00
|
|
|
where rdb$procedure_name = upper('sp_test');
|
|
|
|
commit;
|
|
|
|
|
|
|
|
drop procedure sp_test;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
-- no rows must be issued:
|
2022-01-23 20:41:55 +01:00
|
|
|
select 'point-5' as msg, rdb$parameter_name, rdb$parameter_type, rdb$field_source
|
|
|
|
from rdb$procedure_parameters
|
2021-04-26 20:07:00 +02:00
|
|
|
where rdb$procedure_name = upper('sp_test');
|
|
|
|
|
|
|
|
-- no rows must be issued:
|
2022-01-23 20:41:55 +01:00
|
|
|
select 'point-6' as msg, rdb$procedure_source
|
|
|
|
from rdb$procedures
|
2021-04-26 20:07:00 +02:00
|
|
|
where rdb$procedure_name = upper('sp_test');
|
|
|
|
commit;
|
|
|
|
|
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=[('PROCEDURE_SOURCE .*', '')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
MSG point-1
|
|
|
|
RDB$PARAMETER_NAME INFO
|
|
|
|
RDB$PARAMETER_TYPE 1
|
|
|
|
RDB$FIELD_SOURCE RDB$SOURCE
|
|
|
|
Records affected: 1
|
|
|
|
|
|
|
|
|
|
|
|
MSG point-2
|
|
|
|
RDB$PROCEDURE_SOURCE 1a:1e0
|
|
|
|
begin
|
|
|
|
info = 'foo';
|
|
|
|
suspend;
|
|
|
|
end
|
|
|
|
Records affected: 1
|
|
|
|
|
|
|
|
|
|
|
|
MSG point-3
|
|
|
|
RDB$PARAMETER_NAME MEMO_INFO
|
|
|
|
RDB$PARAMETER_TYPE 1
|
|
|
|
RDB$FIELD_SOURCE RDB$DESCRIPTION
|
|
|
|
|
|
|
|
MSG point-3
|
|
|
|
RDB$PARAMETER_NAME WHOAMI
|
|
|
|
RDB$PARAMETER_TYPE 0
|
|
|
|
RDB$FIELD_SOURCE RDB$USER
|
|
|
|
Records affected: 2
|
2022-01-23 20:41:55 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
MSG point-4
|
|
|
|
RDB$PROCEDURE_SOURCE 1a:1e3
|
|
|
|
begin
|
|
|
|
memo_info = 'bar';
|
|
|
|
suspend;
|
|
|
|
end
|
|
|
|
Records affected: 1
|
|
|
|
|
|
|
|
Records affected: 0
|
|
|
|
|
|
|
|
Records affected: 0
|
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_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|