Skip to content

Commit a761949

Browse files
committed
Added/Updated tests\bugs\gh_7691_test.py: Checked on 5.0.0.1190, 4.0.4.2986.
1 parent ae4acb2 commit a761949

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

tests/bugs/gh_7691_test.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: issue-7691
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7691
6+
TITLE: 'with caller privileges' has no effect in triggers
7+
DESCRIPTION:
8+
NOTES:
9+
[07.09.2023]
10+
Confirmed bug on 5.0.0.1182.
11+
Checked on 5.0.0.1190, 4.0.4.2986.
12+
"""
13+
14+
import pytest
15+
from firebird.qa import *
16+
17+
db = db_factory()
18+
tmp_user = user_factory('db', name='tmp_user_7691', password='123')
19+
20+
act = python_act('db')
21+
22+
@pytest.mark.version('>=4.0.3')
23+
def test_1(act: Action, tmp_user: User, capsys):
24+
test_sql = f"""
25+
set list on;
26+
set bail on;
27+
create table test(
28+
id int
29+
,name varchar(15)
30+
);
31+
commit;
32+
insert into test(id , name) values (1, 'qwerty');
33+
commit;
34+
35+
create table test_2(
36+
id int
37+
,name varchar(15)
38+
);
39+
grant all on table test_2 to user {tmp_user.name};
40+
commit;
41+
42+
set term ^;
43+
create or alter trigger test_2_trigger
44+
for test_2
45+
active before insert or update or delete
46+
position 100
47+
as
48+
declare k int;
49+
begin
50+
execute statement 'select first 1 1 from test '
51+
with caller privileges
52+
into k;
53+
end
54+
^
55+
set term ;^
56+
57+
grant all on table test_2 to trigger test_2_trigger;
58+
59+
grant select on table test to trigger test_2_trigger; -- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
60+
commit;
61+
62+
connect '{act.db.dsn}' user {tmp_user.name} password '{tmp_user.password}';
63+
insert into test_2(id, name) values (1234, 'qwerty');
64+
commit;
65+
66+
select * from test_2;
67+
"""
68+
69+
expected_stdout = """
70+
ID 1234
71+
NAME qwerty
72+
"""
73+
74+
act.expected_stdout = expected_stdout
75+
act.isql(switches=['-q'], input = test_sql, combine_output = True)
76+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)