|
40 | 40 | https://github.com/FirebirdSQL/firebird/commit/f59905fc29f0b9288d61fc6113fd24301dce1327 |
41 | 41 | Frontported PR #8186 : Fixed a few issues with IPC used by remote profiler |
42 | 42 | Snapshots: 6.0.0.398-f59905f, 5.0.1.1440-7b1b824 |
| 43 | +
|
| 44 | + [03.07.2025] pzotov |
| 45 | + Adjusted for FB 6.x: it is MANDATORY to specify schema `PLG$PROFILER.` when querying created profiler tables. |
| 46 | + See doc/sql.extensions/README.schemas.md, section title: '### gbak'; see 'SQL_SCHEMA_PREFIX' variable here. |
| 47 | + Also, on FB 6.x one need to use: 'grant usage on schema "PLG$PROFILER" to role ...' |
| 48 | + Checked on 6.0.0.970; 5.0.3.1668. |
| 49 | +
|
43 | 50 | """ |
44 | 51 |
|
45 | 52 | import pytest |
|
111 | 118 | @pytest.mark.version('>=5.0.1') |
112 | 119 | def test_1(act: Action, tmp_worker_usr: User, tmp_profiler_usr: User, tmp_profiler_role: Role, capsys): |
113 | 120 |
|
| 121 | + PLG_SCHEMA_PREFIX = '' if act.is_version('<6') else f'PLG$PROFILER.' |
| 122 | + |
114 | 123 | addi_script = f""" |
115 | 124 | set wng off; |
116 | 125 | set bail on; |
@@ -168,24 +177,25 @@ def test_1(act: Action, tmp_worker_usr: User, tmp_profiler_usr: User, tmp_profil |
168 | 177 | ################################# |
169 | 178 | # ::: NB ::: Why this is needed ? |
170 | 179 | ################################# |
171 | | - con_admin.execute_immediate(f'grant select on plg$prof_sessions to role {tmp_profiler_role.name}') |
172 | | - con_admin.execute_immediate(f'grant select on plg$prof_psql_stats_view to role {tmp_profiler_role.name}') |
| 180 | + |
| 181 | + # firebird.driver.types.DatabaseError: no permission for USAGE access to SCHEMA "PLG$PROFILER" |
| 182 | + # -Effective user is TMP_PROFILER_8176 |
| 183 | + if act.is_version('<6'): |
| 184 | + pass |
| 185 | + else: |
| 186 | + con_admin.execute_immediate(f'grant usage on schema "{PLG_SCHEMA_PREFIX[:-1]}" to role {tmp_profiler_role.name}') |
| 187 | + |
| 188 | + con_admin.execute_immediate(f'grant select on {PLG_SCHEMA_PREFIX}plg$prof_sessions to role {tmp_profiler_role.name}') |
| 189 | + con_admin.execute_immediate(f'grant select on {PLG_SCHEMA_PREFIX}plg$prof_psql_stats_view to role {tmp_profiler_role.name}') |
173 | 190 | con_admin.commit() |
174 | 191 | #------------------------------------------------------------------------------ |
175 | 192 |
|
176 | 193 | tx_profiler.begin() |
177 | | - cur_profiler.execute('select description as profiler_session_descr, attachment_id as profiled_attachment, trim(user_name) as who_was_profiled from plg$prof_sessions order by profile_id') |
| 194 | + cur_profiler.execute(f'select description as profiler_session_descr, attachment_id as profiled_attachment, trim(user_name) as who_was_profiled from {PLG_SCHEMA_PREFIX}plg$prof_sessions order by profile_id') |
178 | 195 | cur_cols = cur_profiler.description |
179 | 196 | for r in cur_profiler: |
180 | 197 | for i in range(0,len(cur_cols)): |
181 | 198 | print( cur_cols[i][0], ':', r[i] ) |
182 | | - |
183 | | - #cur_profiler.execute('select * from plg$prof_psql_stats_view') |
184 | | - #cur_cols = cur_profiler.description |
185 | | - #for r in cur_profiler: |
186 | | - # for i in range(0,len(cur_cols)): |
187 | | - # print( cur_cols[i][0], ':', r[i] ) |
188 | | - |
189 | 199 | tx_profiler.commit() |
190 | 200 |
|
191 | 201 | act.expected_stdout = f""" |
|
0 commit comments