Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4a05406

Browse files
committed
Improve display of query results in isolation tests.
Previously, isolationtester displayed SQL query results using some ad-hoc code that clearly hadn't had much effort expended on it. Field values longer than 14 characters weren't separated from the next field, and usually caused misalignment of the columns too. Also there was no visual separation of a query's result from subsequent isolationtester output. This made test result files confusing and hard to read. To improve matters, let's use libpq's PQprint() function. Although that's long since unused by psql, it's still plenty good enough for the purpose here. Like 741d7f1, back-patch to all supported branches, so that this isn't a stumbling block for back-patching isolation test changes. Discussion: https://postgr.es/m/582362.1623798221@sss.pgh.pa.us
1 parent 24043c2 commit 4a05406

File tree

104 files changed

+33268
-13778
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+33268
-13778
lines changed

contrib/test_decoding/expected/concurrent_ddl_dml.out

+418-258
Large diffs are not rendered by default.

contrib/test_decoding/expected/concurrent_stream.out

+10-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ step s1_toast_insert: INSERT INTO stream_test SELECT large_val();
99
step s2_ddl: CREATE TABLE stream_test2(data text);
1010
step s1_commit: COMMIT;
1111
step s1_get_stream_changes: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL,NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1');
12-
data
13-
12+
data
13+
----------------------------------------
1414
opening a streamed block for transaction
15-
streaming change for transaction
15+
streaming change for transaction
1616
closing a streamed block for transaction
17-
committing streamed transaction
18-
?column?
17+
committing streamed transaction
18+
(4 rows)
19+
20+
?column?
21+
--------
22+
stop
23+
(1 row)
1924

20-
stop

contrib/test_decoding/expected/delayed_startup.out

+26-14
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,45 @@ step s1w: INSERT INTO do_write DEFAULT VALUES;
66
step s2init: SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'test_decoding'); <waiting ...>
77
step s1c: COMMIT;
88
step s2init: <... completed>
9-
?column?
9+
?column?
10+
--------
11+
init
12+
(1 row)
1013

11-
init
1214
step s2start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
13-
data
15+
data
16+
----
17+
(0 rows)
1418

1519
step s1b: BEGIN ISOLATION LEVEL SERIALIZABLE;
1620
step s1w: INSERT INTO do_write DEFAULT VALUES;
1721
step s1c: COMMIT;
1822
step s2start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
19-
data
20-
21-
BEGIN
23+
data
24+
--------------------------------------------
25+
BEGIN
2226
table public.do_write: INSERT: id[integer]:2
23-
COMMIT
27+
COMMIT
28+
(3 rows)
29+
2430
step s1b: BEGIN ISOLATION LEVEL SERIALIZABLE;
2531
step s1w: INSERT INTO do_write DEFAULT VALUES;
2632
step s2start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
27-
data
33+
data
34+
----
35+
(0 rows)
2836

2937
step s1c: COMMIT;
3038
step s2start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
31-
data
32-
33-
BEGIN
39+
data
40+
--------------------------------------------
41+
BEGIN
3442
table public.do_write: INSERT: id[integer]:3
35-
COMMIT
36-
?column?
43+
COMMIT
44+
(3 rows)
45+
46+
?column?
47+
--------
48+
stop
49+
(1 row)
3750

38-
stop

contrib/test_decoding/expected/mxact.out

+52-28
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,89 @@ Parsed test spec with 3 sessions
22

33
starting permutation: s0init s0start s1begin s1sharepgclass s2begin s2sharepgclass s0w s0start s2commit s1commit
44
step s0init: SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'test_decoding');
5-
?column?
5+
?column?
6+
--------
7+
init
8+
(1 row)
69

7-
init
810
step s0start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
9-
data
11+
data
12+
----
13+
(0 rows)
1014

1115
step s1begin: BEGIN;
1216
step s1sharepgclass: SELECT count(*) > 1 FROM (SELECT * FROM pg_class FOR SHARE) s;
13-
?column?
17+
?column?
18+
--------
19+
t
20+
(1 row)
1421

15-
t
1622
step s2begin: BEGIN;
1723
step s2sharepgclass: SELECT count(*) > 1 FROM (SELECT * FROM pg_class FOR SHARE) s;
18-
?column?
24+
?column?
25+
--------
26+
t
27+
(1 row)
1928

20-
t
2129
step s0w: INSERT INTO do_write DEFAULT VALUES;
2230
step s0start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
23-
data
24-
25-
BEGIN
31+
data
32+
--------------------------------------------
33+
BEGIN
2634
table public.do_write: INSERT: id[integer]:1
27-
COMMIT
35+
COMMIT
36+
(3 rows)
37+
2838
step s2commit: COMMIT;
2939
step s1commit: COMMIT;
30-
?column?
40+
?column?
41+
--------
42+
stop
43+
(1 row)
3144

32-
stop
3345

3446
starting permutation: s0init s0start s1begin s1keysharepgclass s2begin s2keysharepgclass s0alter s0w s0start s2commit s1commit
3547
step s0init: SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'test_decoding');
36-
?column?
48+
?column?
49+
--------
50+
init
51+
(1 row)
3752

38-
init
3953
step s0start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
40-
data
54+
data
55+
----
56+
(0 rows)
4157

4258
step s1begin: BEGIN;
4359
step s1keysharepgclass: SELECT count(*) > 1 FROM (SELECT * FROM pg_class FOR KEY SHARE) s;
44-
?column?
60+
?column?
61+
--------
62+
t
63+
(1 row)
4564

46-
t
4765
step s2begin: BEGIN;
4866
step s2keysharepgclass: SELECT count(*) > 1 FROM (SELECT * FROM pg_class FOR KEY SHARE) s;
49-
?column?
67+
?column?
68+
--------
69+
t
70+
(1 row)
5071

51-
t
5272
step s0alter: ALTER TABLE do_write ADD column ts timestamptz;
5373
step s0w: INSERT INTO do_write DEFAULT VALUES;
5474
step s0start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
55-
data
56-
57-
BEGIN
58-
COMMIT
59-
BEGIN
75+
data
76+
------------------------------------------------------------------------------
77+
BEGIN
78+
COMMIT
79+
BEGIN
6080
table public.do_write: INSERT: id[integer]:1 ts[timestamp with time zone]:null
61-
COMMIT
81+
COMMIT
82+
(5 rows)
83+
6284
step s2commit: COMMIT;
6385
step s1commit: COMMIT;
64-
?column?
86+
?column?
87+
--------
88+
stop
89+
(1 row)
6590

66-
stop

contrib/test_decoding/expected/oldest_xmin.out

+20-10
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,38 @@ Parsed test spec with 2 sessions
33
starting permutation: s0_begin s0_getxid s1_begin s1_insert s0_alter s0_commit s0_checkpoint s0_get_changes s0_get_changes s1_commit s0_vacuum s0_get_changes
44
step s0_begin: BEGIN;
55
step s0_getxid: SELECT pg_current_xact_id() IS NULL;
6-
?column?
6+
?column?
7+
--------
8+
f
9+
(1 row)
710

8-
f
911
step s1_begin: BEGIN;
1012
step s1_insert: INSERT INTO harvest VALUES ((1, 2, 3));
1113
step s0_alter: ALTER TYPE basket DROP ATTRIBUTE mangos;
1214
step s0_commit: COMMIT;
1315
step s0_checkpoint: CHECKPOINT;
1416
step s0_get_changes: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
15-
data
17+
data
18+
----
19+
(0 rows)
1620

1721
step s0_get_changes: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
18-
data
22+
data
23+
----
24+
(0 rows)
1925

2026
step s1_commit: COMMIT;
2127
step s0_vacuum: VACUUM pg_attribute;
2228
step s0_get_changes: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
23-
data
24-
25-
BEGIN
29+
data
30+
------------------------------------------------------
31+
BEGIN
2632
table public.harvest: INSERT: fruits[basket]:'(1,2,3)'
27-
COMMIT
28-
?column?
33+
COMMIT
34+
(3 rows)
35+
36+
?column?
37+
--------
38+
stop
39+
(1 row)
2940

30-
stop

contrib/test_decoding/expected/ondisk_startup.out

+37-23
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,64 @@ Parsed test spec with 3 sessions
33
starting permutation: s2b s2txid s1init s3b s3txid s2alter s2c s2b s2txid s3c s2c s1insert s1checkpoint s1start s1insert s1alter s1insert s1start
44
step s2b: BEGIN;
55
step s2txid: SELECT pg_current_xact_id() IS NULL;
6-
?column?
6+
?column?
7+
--------
8+
f
9+
(1 row)
710

8-
f
911
step s1init: SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'test_decoding'); <waiting ...>
1012
step s3b: BEGIN;
1113
step s3txid: SELECT pg_current_xact_id() IS NULL;
12-
?column?
14+
?column?
15+
--------
16+
f
17+
(1 row)
1318

14-
f
1519
step s2alter: ALTER TABLE do_write ADD COLUMN addedbys2 int;
1620
step s2c: COMMIT;
1721
step s2b: BEGIN;
1822
step s2txid: SELECT pg_current_xact_id() IS NULL;
19-
?column?
23+
?column?
24+
--------
25+
f
26+
(1 row)
2027

21-
f
2228
step s3c: COMMIT;
2329
step s1init: <... completed>
24-
?column?
30+
?column?
31+
--------
32+
init
33+
(1 row)
2534

26-
init
2735
step s2c: COMMIT;
2836
step s1insert: INSERT INTO do_write DEFAULT VALUES;
2937
step s1checkpoint: CHECKPOINT;
3038
step s1start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
31-
data
32-
33-
BEGIN
39+
data
40+
--------------------------------------------------------------------
41+
BEGIN
3442
table public.do_write: INSERT: id[integer]:1 addedbys2[integer]:null
35-
COMMIT
43+
COMMIT
44+
(3 rows)
45+
3646
step s1insert: INSERT INTO do_write DEFAULT VALUES;
3747
step s1alter: ALTER TABLE do_write ADD COLUMN addedbys1 int;
3848
step s1insert: INSERT INTO do_write DEFAULT VALUES;
3949
step s1start: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');
40-
data
41-
42-
BEGIN
43-
table public.do_write: INSERT: id[integer]:2 addedbys2[integer]:null
44-
COMMIT
45-
BEGIN
46-
COMMIT
47-
BEGIN
50+
data
51+
--------------------------------------------------------------------------------------------
52+
BEGIN
53+
table public.do_write: INSERT: id[integer]:2 addedbys2[integer]:null
54+
COMMIT
55+
BEGIN
56+
COMMIT
57+
BEGIN
4858
table public.do_write: INSERT: id[integer]:3 addedbys2[integer]:null addedbys1[integer]:null
49-
COMMIT
50-
?column?
59+
COMMIT
60+
(8 rows)
61+
62+
?column?
63+
--------
64+
stop
65+
(1 row)
5166

52-
stop

0 commit comments

Comments
 (0)