2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
"""
|
|
|
|
ID: issue-6558
|
|
|
|
ISSUE: 6558
|
|
|
|
TITLE: Server is crashing on long GRANT statement
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-6317
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set bail on;
|
|
|
|
set wng off;
|
|
|
|
create or alter user tmp$c6317 password '123';
|
|
|
|
revoke all on all from tmp$c6317;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
recreate table test (id integer);
|
|
|
|
insert into test(id) values(1);
|
|
|
|
commit;
|
|
|
|
|
|
|
|
grant select, select, select, select, select, select, select, select, select, select, select, select, select, select, select, select on test to tmp$c6317;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
set list on;
|
|
|
|
select
|
|
|
|
rdb$user -- tmp$c6317
|
|
|
|
,rdb$relation_name -- test
|
|
|
|
,rdb$privilege -- S
|
|
|
|
,rdb$grant_option -- 0
|
|
|
|
,rdb$field_name -- <null>
|
|
|
|
,rdb$object_type -- 0
|
|
|
|
from rdb$user_privileges p
|
|
|
|
where upper(p.rdb$relation_name) = upper('test') and rdb$user = upper('tmp$c6317')
|
|
|
|
order by rdb$privilege
|
|
|
|
;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
connect '$(DSN)' user tmp$c6317 password '123';
|
|
|
|
select * from test;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
connect '$(DSN)' user sysdba password 'masterkey';
|
|
|
|
drop user tmp$c6317;
|
|
|
|
commit;
|
|
|
|
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
RDB$USER TMP$C6317
|
|
|
|
RDB$RELATION_NAME TEST
|
|
|
|
RDB$PRIVILEGE S
|
|
|
|
RDB$GRANT_OPTION 0
|
|
|
|
RDB$FIELD_NAME <null>
|
|
|
|
RDB$OBJECT_TYPE 0
|
|
|
|
|
|
|
|
ID 1
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0.6')
|
2022-01-27 20:08:36 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|