Skip to content

Commit 828ac10

Browse files
committed
Added/Updated tests\bugs\gh_7687_test.py: Adjusted for FB 6.x: it is MANDATORY to specify schema PLG$PROFILER. when querying created profiler tables. Separated expected output for FB major versions prior/since 6.x.
1 parent dc19797 commit 828ac10

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

tests/bugs/gh_7687_test.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@
5858
It seems that following commits caused this:
5959
https://github.com/FirebirdSQL/firebird/commit/ae427762d5a3e740b69c7239acb9e2383bc9ca83 // 5.x
6060
https://github.com/FirebirdSQL/firebird/commit/f647dfd757de3c4065ef2b875c95d19311bb9691 // 6.x
61+
62+
[03.07.2025] pzotov
63+
Adjusted for FB 6.x: it is MANDATORY to specify schema `PLG$PROFILER.` when querying created profiler tables.
64+
See doc/sql.extensions/README.schemas.md, section title: '### gbak'; see 'SQL_SCHEMA_PREFIX' variable here.
65+
Separated expected output for FB major versions prior/since 6.x.
66+
No substitutions are used to suppress schema and quotes. Discussed with dimitr, 24.06.2025 12:39.
67+
Checked on 6.0.0.970; 5.0.3.1668.
6168
"""
6269

6370
import os
@@ -70,6 +77,7 @@
7077
@pytest.mark.version('>=5.0')
7178
def test_1(act: Action, capsys):
7279

80+
SQL_SCHEMA_PREFIX = '' if act.is_version('<6') else 'PLG$PROFILER.'
7381
test_sql = f"""
7482
recreate table tdetl(id int);
7583
recreate table tmain(id int primary key using index tmain_pk, x int);
@@ -103,8 +111,8 @@ def test_1(act: Action, capsys):
103111
,substring('#' || lpad('', 4*t.level,' ') || replace( replace(t.access_path, ascii_char(13), ''), ascii_char(10), ascii_char(10) || '#' || lpad('', 4*t.level,' ') ) from 1 for 320) as acc_path
104112
,substring( cast(t.sql_text as varchar(255)) from 1 for 50 ) as sql_text
105113
,dense_rank()over(order by t.level) as ranked_level
106-
from plg$prof_record_source_stats_view t
107-
join plg$prof_sessions s
114+
from {SQL_SCHEMA_PREFIX}plg$prof_record_source_stats_view t
115+
join {SQL_SCHEMA_PREFIX}plg$prof_sessions s
108116
on s.profile_id = t.profile_id and
109117
s.description = 'profile session 1'
110118
;
@@ -159,7 +167,7 @@ def test_1(act: Action, capsys):
159167
select acc_path as access_path_blob_id from r;
160168
"""
161169

162-
act.expected_stdout = f"""
170+
expected_stdout_5x = f"""
163171
#Select Expression
164172
# -> Filter (preliminary)
165173
# -> Nested Loop Join (inner)
@@ -179,6 +187,28 @@ def test_1(act: Action, capsys):
179187
# -> Index "TDETL_FK" Full Scan
180188
Records affected: 10
181189
"""
190+
191+
expected_stdout_6x = f"""
192+
#Select Expression
193+
# -> Filter (preliminary)
194+
# -> Nested Loop Join (inner)
195+
# -> Table "PUBLIC"."TMAIN" as "PUBLIC"."V_TEST" "M4" Full Scan
196+
# -> Filter
197+
# -> Table "PUBLIC"."TDETL" as "PUBLIC"."V_TEST" "D4" "DX" Access By ID
198+
# -> Bitmap And
199+
# -> Bitmap And
200+
# -> Bitmap
201+
# -> Index "PUBLIC"."TDETL_Z" Range Scan (lower bound: 1/1)
202+
#
203+
#Sub-query (invariant)
204+
# -> Filter
205+
# -> Aggregate
206+
# -> Table "PUBLIC"."TDETL" as "PUBLIC"."V_TEST" "DY" Access By ID
207+
# -> Index "PUBLIC"."TDETL_FK" Full Scan
208+
Records affected: 10
209+
"""
210+
211+
act.expected_stdout = expected_stdout_5x if act.is_version('<6') else expected_stdout_6x
182212
act.isql(input = test_sql, combine_output = True)
183213
assert act.clean_stdout == act.clean_expected_stdout
184214
act.reset()

0 commit comments

Comments
 (0)