Debian Codegraph @

contrib/test_decoding/sql/messages.sql

raw
1 -- predictability
2 SET synchronous_commit = on;
3
4 SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
5
6 -- These two cover the path for the flush variant.
7 SELECT 'msg1' FROM pg_logical_emit_message(true, 'test', 'msg1', true);
8 SELECT 'msg2' FROM pg_logical_emit_message(false, 'test', 'msg2', true);
9
10 BEGIN;
11 SELECT 'msg3' FROM pg_logical_emit_message(true, 'test', 'msg3');
12 SELECT 'msg4' FROM pg_logical_emit_message(false, 'test', 'msg4');
13 ROLLBACK;
14
15 BEGIN;
16 SELECT 'msg5' FROM pg_logical_emit_message(true, 'test', 'msg5');
17 SELECT 'msg6' FROM pg_logical_emit_message(false, 'test', 'msg6');
18 SELECT 'msg7' FROM pg_logical_emit_message(true, 'test', 'msg7');
19 COMMIT;
20
21 SELECT 'ignorethis' FROM pg_logical_emit_message(true, 'test', 'czechtastic');
22
23 SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '0', 'skip-empty-xacts', '1', 'include-xids', '0');
24
25 -- test db filtering
26 \set prevdb :DBNAME
27 \c template1
28
29 SELECT 'otherdb1' FROM pg_logical_emit_message(false, 'test', 'otherdb1');
30 SELECT 'otherdb2' FROM pg_logical_emit_message(true, 'test', 'otherdb2');
31
32 \c :prevdb
33 SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '0', 'skip-empty-xacts', '1');
34
35 SELECT 'cleanup' FROM pg_drop_replication_slot('regression_slot');