|
7 | 7 | DESCRIPTION: |
8 | 8 | JIRA: CORE-4164 |
9 | 9 | FBTEST: bugs.core_4164 |
| 10 | +NOTES: |
| 11 | + [17.07.2025] pzotov |
| 12 | + Checked on 6.0.0.835; 5.0.3.1661; 4.0.6.3207; 3.0.13.33807. |
10 | 13 | """ |
11 | 14 |
|
12 | 15 | import pytest |
|
25 | 28 | -- ==> and then do backup. |
26 | 29 | """ |
27 | 30 |
|
28 | | -db = db_factory(from_backup='core4164.fbk', init=init_script) |
| 31 | +db = db_factory(from_backup='core4164.fbk') |
29 | 32 |
|
30 | | -test_script = """ |
31 | | - set width usr 10; |
32 | | - set width grantor 10; |
33 | | - set width priv 4; |
34 | | - set width with_grant 6; |
35 | | - set width obj_name 10; |
36 | | - set width fld_name 15; |
| 33 | +act = isql_act('db', substitutions=[('=.*', '')]) |
37 | 34 |
|
38 | | - select |
39 | | - p.rdb$user usr |
40 | | - ,p.rdb$grantor grantor |
41 | | - ,p.rdb$privilege priv |
42 | | - -- ::: NB ::: Field rdb$grant_option will contain NULLs after restoring, |
43 | | - -- but <null> and 0 are considered by engine as the same in RDB$ tables. |
44 | | - -- Decided to apply `coalesce` after consulting with Dmitry, letter 27.03.2015 19:26 |
45 | | - ,coalesce(p.rdb$grant_option, 0) with_grant |
46 | | - ,p.rdb$relation_name obj_name |
47 | | - ,p.rdb$user_type usr_type |
48 | | - ,p.rdb$object_type obj_type |
49 | | - ,p.rdb$field_name fld_name |
50 | | - from rdb$user_privileges p |
51 | | - where upper(trim(p.rdb$relation_name)) in ( upper('g'), upper('e') ) |
52 | | - ; |
53 | | -""" |
| 35 | +@pytest.mark.version('>=3.0') |
| 36 | +def test_1(act: Action): |
54 | 37 |
|
55 | | -act = isql_act('db', test_script, substitutions=[('=.*', '')]) |
| 38 | + SQL_SCHEMA_PREFIX = '' if act.is_version('<6') else 'PUBLIC.' |
| 39 | + test_script = f""" |
| 40 | + set width usr 10; |
| 41 | + set width grantor 10; |
| 42 | + set width priv 4; |
| 43 | + set width with_grant 6; |
| 44 | + set width obj_name 10; |
| 45 | + set width fld_name 15; |
| 46 | + set count on; |
| 47 | + select |
| 48 | + p.rdb$user usr |
| 49 | + ,p.rdb$grantor grantor |
| 50 | + ,p.rdb$privilege priv |
| 51 | + -- ::: NB ::: Field rdb$grant_option will contain NULLs after restoring, |
| 52 | + -- but <null> and 0 are considered by engine as the same in RDB$ tables. |
| 53 | + -- Decided to apply `coalesce` after consulting with Dmitry, letter 27.03.2015 19:26 |
| 54 | + ,coalesce(p.rdb$grant_option, 0) with_grant |
| 55 | + ,p.rdb$relation_name obj_name |
| 56 | + ,p.rdb$user_type usr_type |
| 57 | + ,p.rdb$object_type obj_type |
| 58 | + ,p.rdb$field_name fld_name |
| 59 | + from rdb$user_privileges p |
| 60 | + where upper(trim(p.rdb$relation_name)) in ( upper('g'), upper('e') ) |
| 61 | + order by usr, grantor, obj_name, with_grant |
| 62 | + ; |
| 63 | + """ |
56 | 64 |
|
57 | | -expected_stdout = """ |
58 | | - USR GRANTOR PRIV WITH_GRANT OBJ_NAME USR_TYPE OBJ_TYPE FLD_NAME |
59 | | - ========== ========== ==== ============ ========== ======== ======== =============== |
60 | | - SYSDBA SYSDBA G 1 G 8 14 <null> |
61 | | - SYSDBA SYSDBA G 1 E 8 7 <null> |
62 | | - TMP$4164 SYSDBA G 0 G 8 14 <null> |
63 | | - TMP$4164 SYSDBA G 0 E 8 7 <null> |
64 | | - MGR$4164 SYSDBA G 1 G 8 14 <null> |
65 | | - MGR$4164 SYSDBA G 1 E 8 7 <null> |
66 | | -""" |
| 65 | + expected_stdout = """ |
| 66 | + USR GRANTOR PRIV WITH_GRANT OBJ_NAME USR_TYPE OBJ_TYPE FLD_NAME |
| 67 | + MGR$4164 SYSDBA G 1 E 8 7 <null> |
| 68 | + MGR$4164 SYSDBA G 1 G 8 14 <null> |
| 69 | + SYSDBA SYSDBA G 1 E 8 7 <null> |
| 70 | + SYSDBA SYSDBA G 1 G 8 14 <null> |
| 71 | + TMP$4164 SYSDBA G 0 E 8 7 <null> |
| 72 | + TMP$4164 SYSDBA G 0 G 8 14 <null> |
| 73 | + Records affected: 6 |
| 74 | + """ |
67 | 75 |
|
68 | | -@pytest.mark.version('>=3.0') |
69 | | -def test_1(act: Action): |
70 | 76 | act.expected_stdout = expected_stdout |
71 | | - act.execute() |
| 77 | + act.isql(switches = ['-q'], input = test_script, combine_output = True) |
72 | 78 | assert act.clean_stdout == act.clean_expected_stdout |
73 | 79 |
|
0 commit comments