Skip to content

Commit

Permalink
Switch to a text array for parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
bonnefoa committed Jul 5, 2024
1 parent c06d438 commit baf3470
Show file tree
Hide file tree
Showing 24 changed files with 426 additions and 334 deletions.
194 changes: 97 additions & 97 deletions expected/extended.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ SELECT $1, $2 \bind 1 2 \g
(1 row)

SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
--------------+----------------+--------------------+-----
Select query | SELECT $1, $2 | $1 = '1', $2 = '2' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
span_type | span_operation | parameters | lvl
--------------+----------------+------------+-----
Select query | SELECT $1, $2 | {1,2} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
(4 rows)

CALL clean_spans();
Expand Down Expand Up @@ -64,28 +64,28 @@ SELECT count(distinct(trace_id)) = 1 FROM pg_tracing_peek_spans;
(1 row)

SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
----------------+----------------+--------------------+-----
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | $1 = '1' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | $1 = '2', $2 = '3' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
Utility query | BEGIN | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | $1 = '1' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
span_type | span_operation | parameters | lvl
----------------+----------------+------------+-----
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
Utility query | BEGIN | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
(20 rows)

CALL clean_spans();
Expand Down Expand Up @@ -118,24 +118,24 @@ SELECT count(distinct(trace_id)) = 1 FROM pg_tracing_peek_spans;
(1 row)

SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
----------------+--------------------+------------------------+-----
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | $1 = '1' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3; | $1 = 5, $2 = 6, $3 = 7 | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | $1 = '2', $2 = '3' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
span_type | span_operation | parameters | lvl
----------------+--------------------+------------+-----
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3; | {5,6,7} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
(16 rows)

CALL clean_spans();
Expand All @@ -147,14 +147,14 @@ SELECT 1 \gdesc
(1 row)

SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
--------------+--------------------------------------------------------------------+-------------------------------------+-----
Select query | SELECT $1 | $1 = 1 | 1
Select query | SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"+| $1 = '?column?', $2 = '23', $3 = -1 | 1
| FROM (VALUES ($1, $2::pg_catalog.oid,$3)) s(name, tp, tpm) | |
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
span_type | span_operation | parameters | lvl
--------------+--------------------------------------------------------------------+----------------------+-----
Select query | SELECT $1 | {1} | 1
Select query | SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"+| {'?column?','23',-1} | 1
| FROM (VALUES ($1, $2::pg_catalog.oid,$3)) s(name, tp, tpm) | |
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
(5 rows)

CALL clean_spans();
Expand Down Expand Up @@ -182,24 +182,24 @@ SELECT $1, $2, $3 \bind 1 2 3 \g

COMMIT;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans WHERE trace_id='00000000000000000000000000000001';
span_type | span_operation | parameters | lvl
----------------+-------------------+------------------------------+-----
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | $1 = '1' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | $1 = '1', $2 = '2' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | $1 = '1', $2 = '2', $3 = '3' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
span_type | span_operation | parameters | lvl
----------------+-------------------+------------+-----
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {1,2} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | {1,2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
(16 rows)

-- Test tracing only individual statements with extended protocol
Expand All @@ -224,20 +224,20 @@ BEGIN;

COMMIT;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans WHERE trace_id='00000000000000000000000000000002';
span_type | span_operation | parameters | lvl
--------------+-------------------+------------------------------+-----
Select query | SELECT $1 | $1 = '1' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | $1 = '1', $2 = '2' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | $1 = '1', $2 = '2', $3 = '3' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
span_type | span_operation | parameters | lvl
--------------+-------------------+------------+-----
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {1,2} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | {1,2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
(12 rows)

-- Test tracing only subset of individual statements with extended protocol
Expand Down Expand Up @@ -268,16 +268,16 @@ SELECT $1 \bind 1 \g

COMMIT;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans WHERE trace_id='00000000000000000000000000000003';
span_type | span_operation | parameters | lvl
--------------+-------------------+------------------------------+-----
Select query | SELECT $1 | $1 = '1' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | $1 = '1', $2 = '2', $3 = '3' | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
span_type | span_operation | parameters | lvl
--------------+-------------------+------------+-----
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | {1,2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
(8 rows)

-- Test tracing the whole transaction with extended protocol with BEGIN sent through extended protocol
Expand All @@ -294,7 +294,7 @@ SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans WHERE
----------------+----------------+------------+-----
Utility query | BEGIN | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | $1 = '1' | 1
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Expand Down
42 changes: 21 additions & 21 deletions expected/guc.out
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ SELECT 3;
select trace_id, span_operation, parameters, lvl from peek_ordered_spans;
trace_id | span_operation | parameters | lvl
----------------------------------+----------------+------------+-----
00000000000000000000000000000004 | SELECT $1; | $1 = 1 | 1
00000000000000000000000000000004 | SELECT $1; | {1} | 1
00000000000000000000000000000004 | Planner | | 2
00000000000000000000000000000004 | ExecutorRun | | 2
00000000000000000000000000000004 | Result | | 3
fffffffffffffffffffffffffffffff5 | SELECT $1; | $1 = 2 | 1
fffffffffffffffffffffffffffffff5 | SELECT $1; | {2} | 1
fffffffffffffffffffffffffffffff5 | Planner | | 2
fffffffffffffffffffffffffffffff5 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff5 | Result | | 3
fffffffffffffffffffffffffffffff5 | SELECT $1; | $1 = 3 | 1
fffffffffffffffffffffffffffffff5 | SELECT $1; | {3} | 1
fffffffffffffffffffffffffffffff5 | Planner | | 2
fffffffffffffffffffffffffffffff5 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff5 | Result | | 3
Expand Down Expand Up @@ -67,24 +67,24 @@ SELECT 3;

-- Check mix SQLCommenter and GUC propagation
select trace_id, span_operation, parameters, lvl from peek_ordered_spans;
trace_id | span_operation | parameters | lvl
----------------------------------+--------------------+------------------------+-----
fffffffffffffffffffffffffffffff6 | SELECT $1; | $1 = 2 | 1
fffffffffffffffffffffffffffffff6 | Planner | | 2
fffffffffffffffffffffffffffffff6 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff6 | Result | | 3
fffffffffffffffffffffffffffffff6 | SELECT $1, $2; | $1 = 1, $2 = 1 | 1
fffffffffffffffffffffffffffffff6 | Planner | | 2
fffffffffffffffffffffffffffffff6 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff6 | Result | | 3
fffffffffffffffffffffffffffffff6 | SELECT $1, $2, $3; | $1 = 1, $2 = 2, $3 = 3 | 1
fffffffffffffffffffffffffffffff6 | Planner | | 2
fffffffffffffffffffffffffffffff6 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff6 | Result | | 3
fffffffffffffffffffffffffffffff6 | SELECT $1; | $1 = 3 | 1
fffffffffffffffffffffffffffffff6 | Planner | | 2
fffffffffffffffffffffffffffffff6 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff6 | Result | | 3
trace_id | span_operation | parameters | lvl
----------------------------------+--------------------+------------+-----
fffffffffffffffffffffffffffffff6 | SELECT $1; | {2} | 1
fffffffffffffffffffffffffffffff6 | Planner | | 2
fffffffffffffffffffffffffffffff6 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff6 | Result | | 3
fffffffffffffffffffffffffffffff6 | SELECT $1, $2; | {1,1} | 1
fffffffffffffffffffffffffffffff6 | Planner | | 2
fffffffffffffffffffffffffffffff6 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff6 | Result | | 3
fffffffffffffffffffffffffffffff6 | SELECT $1, $2, $3; | {1,2,3} | 1
fffffffffffffffffffffffffffffff6 | Planner | | 2
fffffffffffffffffffffffffffffff6 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff6 | Result | | 3
fffffffffffffffffffffffffffffff6 | SELECT $1; | {3} | 1
fffffffffffffffffffffffffffffff6 | Planner | | 2
fffffffffffffffffffffffffffffff6 | ExecutorRun | | 2
fffffffffffffffffffffffffffffff6 | Result | | 3
(16 rows)

CALL clean_spans();
Expand Down
Loading

0 comments on commit baf3470

Please sign in to comment.