Skip to content

Commit

Permalink
Update utility test expectation
Browse files Browse the repository at this point in the history
On HEAD, dc68515968 will capture SET's parameters as constants, allowing
to normalise them and add placeholder. Update utility tests' expectation
to avoid tracing SET queries.
  • Loading branch information
bonnefoa committed Oct 10, 2024
1 parent 8022813 commit c5c89e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 9 additions & 10 deletions expected/utility.out
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ select count(*) = 0 from pg_tracing_consume_spans;

-- Force a query to start from ExecutorRun
SET plan_cache_mode='force_generic_plan';
CALL clean_spans();
EXECUTE test_prepared_one_param(200);
?column?
----------
Expand Down Expand Up @@ -324,6 +325,7 @@ SELECT query_id = :query_id from pg_tracing_peek_spans where trace_id='000000000
CALL clean_spans();
-- Test prepared statement with generic plan
SET plan_cache_mode='force_generic_plan';
CALL clean_spans();
EXECUTE test_prepared_one_param(200);
?column?
----------
Expand All @@ -335,32 +337,29 @@ SET plan_cache_mode TO DEFAULT;
select count(distinct(trace_id)) from pg_tracing_peek_spans;
count
-------
3
2
(1 row)

-- Check spans of test_prepared_one_param execution
select span_operation, parameters, lvl from peek_ordered_spans;
span_operation | parameters | lvl
---------------------------------------------------------+------------+-----
SET plan_cache_mode='force_generic_plan'; | | 1
ProcessUtility | | 2
EXECUTE test_prepared_one_param(200); | | 1
ProcessUtility | | 2
PREPARE test_prepared_one_param (integer) AS SELECT $1; | | 3
ExecutorRun | | 4
Result | | 5
SET plan_cache_mode TO DEFAULT; | | 1
ProcessUtility | | 2
(9 rows)
(7 rows)

-- Check the top span (standalone top span has trace_id=parent_id)
select span_operation, parameters, lvl from peek_ordered_spans where right(trace_id, 16) = parent_id;
span_operation | parameters | lvl
-------------------------------------------+------------+-----
SET plan_cache_mode='force_generic_plan'; | | 1
EXECUTE test_prepared_one_param(200); | | 1
SET plan_cache_mode TO DEFAULT; | | 1
(3 rows)
span_operation | parameters | lvl
---------------------------------------+------------+-----
EXECUTE test_prepared_one_param(200); | | 1
SET plan_cache_mode TO DEFAULT; | | 1
(2 rows)

CALL clean_spans();
-- Second create extension should generate an error that is captured by span
Expand Down
2 changes: 2 additions & 0 deletions sql/utility.sql
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ select count(*) = 0 from pg_tracing_consume_spans;

-- Force a query to start from ExecutorRun
SET plan_cache_mode='force_generic_plan';
CALL clean_spans();
EXECUTE test_prepared_one_param(200);
SET plan_cache_mode TO DEFAULT;

Expand Down Expand Up @@ -276,6 +277,7 @@ CALL clean_spans();

-- Test prepared statement with generic plan
SET plan_cache_mode='force_generic_plan';
CALL clean_spans();
EXECUTE test_prepared_one_param(200);
SET plan_cache_mode TO DEFAULT;

Expand Down

0 comments on commit c5c89e1

Please sign in to comment.