Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pg18 version in makefile with additional extended protocol tests #50

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Supported PostgreSQL versions:
PG_VERSIONS = 15 16 17
PG_VERSIONS = 15 16 17 18

# Default version:
PG_VERSION ?= $(lastword $(PG_VERSIONS))
Expand Down Expand Up @@ -43,6 +43,11 @@ else
REGRESSCHECKS += planstate_projectset_17
endif

# PG 18 contains additional psql metacommand to test extended protocol
ifeq ($(shell test $(PG_VERSION) -ge 18; echo $$?),0)
REGRESSCHECKS += psql_extended
endif

REGRESSCHECKS += sample planstate planstate_bitmap planstate_hash \
planstate_subplans planstate_union \
parallel subxact full_buffer \
Expand Down
112 changes: 112 additions & 0 deletions expected/psql_extended.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
-- Simple query with extended protocol
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ SELECT $1, $2 \parse stmt1
\bind_named stmt1 1 2 \g
?column? | ?column?
----------+----------
1 | 2
(1 row)

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

BEGIN;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000002-0000000000000001-01'*/ select $1 \parse ''
\bind_named '' 1 \g
?column?
----------
1
(1 row)

/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000003-0000000000000001-01'*/ select $1, $2 \parse ''
\bind_named '' 1 2 \g
?column? | ?column?
----------+----------
1 | 2
(1 row)

/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000004-0000000000000001-01'*/ select $1, $2, $3 \parse ''
\bind_named '' 1 2 3 \g
?column? | ?column? | ?column?
----------+----------+----------
1 | 2 | 3
(1 row)

COMMIT;
SELECT trace_id, span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
trace_id | span_type | span_operation | parameters | lvl
----------------------------------+------------------+-------------------+------------+-----
00000000000000000000000000000001 | Select query | SELECT $1, $2 | | 1
00000000000000000000000000000001 | Select query | SELECT $1, $2 | {1,2} | 1
00000000000000000000000000000001 | Planner | Planner | | 2
00000000000000000000000000000001 | ExecutorRun | ExecutorRun | | 2
00000000000000000000000000000001 | Result | Result | | 3
00000000000000000000000000000002 | TransactionBlock | TransactionBlock | | 1
00000000000000000000000000000002 | Select query | select $1 | {1} | 2
00000000000000000000000000000002 | Planner | Planner | | 3
00000000000000000000000000000002 | ExecutorRun | ExecutorRun | | 3
00000000000000000000000000000002 | Result | Result | | 4
00000000000000000000000000000003 | Select query | SELECT $1, $2 | {1,2} | 2
00000000000000000000000000000003 | Planner | Planner | | 3
00000000000000000000000000000003 | ExecutorRun | ExecutorRun | | 3
00000000000000000000000000000003 | Result | Result | | 4
00000000000000000000000000000004 | Select query | select $1, $2, $3 | {1,2,3} | 2
00000000000000000000000000000004 | Planner | Planner | | 3
00000000000000000000000000000004 | ExecutorRun | ExecutorRun | | 3
00000000000000000000000000000004 | Result | Result | | 4
(18 rows)

/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000005-0000000000000001-01'*/ BEGIN;
select $1 \parse ''
\bind_named '' 1 \g
?column?
----------
1
(1 row)

select $1, $2 \parse ''
\bind_named '' 1 2 \g
?column? | ?column?
----------+----------
1 | 2
(1 row)

select $1, $2, $3 \parse ''
\bind_named '' 1 2 3 \g
?column? | ?column? | ?column?
----------+----------+----------
1 | 2 | 3
(1 row)

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

-- Cleanup
CALL clean_spans();
CALL reset_settings();
31 changes: 31 additions & 0 deletions sql/psql_extended.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- Simple query with extended protocol
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ SELECT $1, $2 \parse stmt1
\bind_named stmt1 1 2 \g

SELECT trace_id, span_type, span_operation, parameters, lvl FROM peek_ordered_spans;

BEGIN;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000002-0000000000000001-01'*/ select $1 \parse ''
\bind_named '' 1 \g
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000003-0000000000000001-01'*/ select $1, $2 \parse ''
\bind_named '' 1 2 \g
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000004-0000000000000001-01'*/ select $1, $2, $3 \parse ''
\bind_named '' 1 2 3 \g
COMMIT;

SELECT trace_id, span_type, span_operation, parameters, lvl FROM peek_ordered_spans;

/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000005-0000000000000001-01'*/ BEGIN;
select $1 \parse ''
\bind_named '' 1 \g
select $1, $2 \parse ''
\bind_named '' 1 2 \g
select $1, $2, $3 \parse ''
\bind_named '' 1 2 3 \g
COMMIT;

SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans where trace_id='00000000000000000000000000000005';

-- Cleanup
CALL clean_spans();
CALL reset_settings();