1-- predictability
2SET synchronous_commit = on;
3SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
4 ?column?
5----------
6 init
7(1 row)
8
9-- succeeds, textual plugin, textual consumer
10SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '0', 'skip-empty-xacts', '1');
11 data
12------
13(0 rows)
14
15-- fails, binary plugin, textual consumer
16SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '1', 'skip-empty-xacts', '1');
17ERROR:  logical decoding output plugin "test_decoding" produces binary output, but function "pg_logical_slot_get_changes(name,pg_lsn,integer,text[])" expects textual data
18-- succeeds, textual plugin, binary consumer
19SELECT data FROM pg_logical_slot_get_binary_changes('regression_slot', NULL, NULL, 'force-binary', '0', 'skip-empty-xacts', '1');
20 data
21------
22(0 rows)
23
24-- succeeds, binary plugin, binary consumer
25SELECT data FROM pg_logical_slot_get_binary_changes('regression_slot', NULL, NULL, 'force-binary', '1', 'skip-empty-xacts', '1');
26 data
27------
28(0 rows)
29
30SELECT 'init' FROM pg_drop_replication_slot('regression_slot');
31 ?column?
32----------
33 init
34(1 row)
35
36