File: type_oid.out

package info (click to toggle)
wal2json 2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,672 kB
  • sloc: ansic: 2,524; sql: 1,136; makefile: 27; sh: 6
file content (68 lines) | stat: -rw-r--r-- 5,394 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
\set VERBOSITY terse
-- predictability
SET synchronous_commit = on;
DROP TABLE IF EXISTS w2j_type_oid;
NOTICE:  table "w2j_type_oid" does not exist, skipping
CREATE TABLE w2j_type_oid (a integer, b boolean, primary key(a));
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'wal2json');
 ?column? 
----------
 init
(1 row)

INSERT INTO w2j_type_oid (a, b) VALUES(1, true);
UPDATE w2j_type_oid SET a = 3;
DELETE FROM w2j_type_oid WHERE a = 3;
-- without include-type-oids parameter
SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'format-version', '1');
                                                                                                              data                                                                                                               
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"change":[{"kind":"insert","schema":"public","table":"w2j_type_oid","columnnames":["a","b"],"columntypes":["integer","boolean"],"columnvalues":[1,true]}]}
 {"change":[{"kind":"update","schema":"public","table":"w2j_type_oid","columnnames":["a","b"],"columntypes":["integer","boolean"],"columnvalues":[3,true],"oldkeys":{"keynames":["a"],"keytypes":["integer"],"keyvalues":[1]}}]}
 {"change":[{"kind":"delete","schema":"public","table":"w2j_type_oid","oldkeys":{"keynames":["a"],"keytypes":["integer"],"keyvalues":[3]}}]}
(3 rows)

SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'format-version', '2');
                                                                                                    data                                                                                                     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"action":"B"}
 {"action":"I","schema":"public","table":"w2j_type_oid","columns":[{"name":"a","type":"integer","value":1},{"name":"b","type":"boolean","value":true}]}
 {"action":"C"}
 {"action":"B"}
 {"action":"U","schema":"public","table":"w2j_type_oid","columns":[{"name":"a","type":"integer","value":3},{"name":"b","type":"boolean","value":true}],"identity":[{"name":"a","type":"integer","value":1}]}
 {"action":"C"}
 {"action":"B"}
 {"action":"D","schema":"public","table":"w2j_type_oid","identity":[{"name":"a","type":"integer","value":3}]}
 {"action":"C"}
(9 rows)

-- with include-type-oids parameter
SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'format-version', '1', 'include-type-oids', '1');
                                                                                                                                    data                                                                                                                                     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"change":[{"kind":"insert","schema":"public","table":"w2j_type_oid","columnnames":["a","b"],"columntypes":["integer","boolean"],"columntypeoids":[23,16],"columnvalues":[1,true]}]}
 {"change":[{"kind":"update","schema":"public","table":"w2j_type_oid","columnnames":["a","b"],"columntypes":["integer","boolean"],"columntypeoids":[23,16],"columnvalues":[3,true],"oldkeys":{"keynames":["a"],"keytypes":["integer"],"keytypeoids":[23],"keyvalues":[1]}}]}
 {"change":[{"kind":"delete","schema":"public","table":"w2j_type_oid","oldkeys":{"keynames":["a"],"keytypes":["integer"],"keytypeoids":[23],"keyvalues":[3]}}]}
(3 rows)

SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'format-version', '2', 'include-type-oids', '1');
                                                                                                                        data                                                                                                                        
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"action":"B"}
 {"action":"I","schema":"public","table":"w2j_type_oid","columns":[{"name":"a","type":"integer","typeoid":23,"value":1},{"name":"b","type":"boolean","typeoid":16,"value":true}]}
 {"action":"C"}
 {"action":"B"}
 {"action":"U","schema":"public","table":"w2j_type_oid","columns":[{"name":"a","type":"integer","typeoid":23,"value":3},{"name":"b","type":"boolean","typeoid":16,"value":true}],"identity":[{"name":"a","type":"integer","typeoid":23,"value":1}]}
 {"action":"C"}
 {"action":"B"}
 {"action":"D","schema":"public","table":"w2j_type_oid","identity":[{"name":"a","type":"integer","typeoid":23,"value":3}]}
 {"action":"C"}
(9 rows)

SELECT 'stop' FROM pg_drop_replication_slot('regression_slot');
 ?column? 
----------
 stop
(1 row)

DROP TABLE w2j_type_oid;