@@ -57,7 +57,11 @@ ROLLBACK TO SAVEPOINT sp1;
57
57
INSERT INTO demo(tx) VALUES ('2');
58
58
COMMIT;
59
59
-- Simple decode with text-format tuples
60
- SELECT data::json
60
+ TRUNCATE TABLE json_decoding_output;
61
+ INSERT INTO json_decoding_output(ch, rn)
62
+ SELECT
63
+ data::jsonb,
64
+ row_number() OVER ()
61
65
FROM pg_logical_slot_peek_changes('regression_slot',
62
66
NULL, NULL,
63
67
'expected_encoding', 'UTF8',
@@ -66,37 +70,64 @@ FROM pg_logical_slot_peek_changes('regression_slot',
66
70
'startup_params_format', '1',
67
71
'proto_format', 'json',
68
72
'no_txinfo', 't');
69
- data
70
- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
71
- {"action":"S", "params": {"max_proto_version":"1","min_proto_version":"1","coltypes":"f","pg_version_num":"90405","pg_version":"9.4.5","pg_catversion":"201409291","database_encoding":"UTF8","encoding":"UTF8","forward_changeset_origins":"t","binary.internal_basetypes":"f","binary.binary_basetypes":"f","binary.basetypes_major_version":"904","binary.sizeof_int":"4","binary.sizeof_long":"8","binary.sizeof_datum":"8","binary.maxalign":"8","binary.bigendian":"f","binary.float4_byval":"t","binary.float8_byval":"t","binary.integer_datetimes":"t","binary.binary_pg_version":"904","no_txinfo":"t","hooks.startup_hook_enabled":"f","hooks.shutdown_hook_enabled":"f","hooks.row_filter_enabled":"f","hooks.transaction_filter_enabled":"f"}}
72
- {"action":"B", "has_catalog_changes":"f"}
73
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":1,"tx":"textval","ts":null,"jsb":null,"js":null,"ba":null}}
74
- {"action":"C"}
75
- {"action":"B", "has_catalog_changes":"f"}
76
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":2,"tx":null,"ts":null,"jsb":null,"js":null,"ba":"\\xdeadbeef0001"}}
77
- {"action":"C"}
78
- {"action":"B", "has_catalog_changes":"f"}
79
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":3,"tx":"blah","ts":"2045-09-12T12:34:56","jsb":null,"js":null,"ba":null}}
80
- {"action":"C"}
81
- {"action":"B", "has_catalog_changes":"f"}
82
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":4,"tx":null,"ts":null,"jsb":{"key": "value"},"js":{"key":"value"},"ba":null}}
83
- {"action":"C"}
84
- {"action":"B", "has_catalog_changes":"f"}
85
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":6,"tx":"row1","ts":null,"jsb":null,"js":null,"ba":null}}
86
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":7,"tx":"row2","ts":null,"jsb":null,"js":null,"ba":null}}
87
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":8,"tx":"row3","ts":null,"jsb":null,"js":null,"ba":null}}
88
- {"action":"D","relation":["public","demo"],"oldtuple":{"seq":7,"tx":null,"ts":null,"jsb":null,"js":null,"ba":null}}
89
- {"action":"U","relation":["public","demo"],"newtuple":{"seq":6,"tx":"updated","ts":null,"jsb":null,"js":null,"ba":null}}
90
- {"action":"C"}
91
- {"action":"B", "has_catalog_changes":"t"}
92
- {"action":"I","relation":["public","cat_test"],"newtuple":{"id":42}}
93
- {"action":"C"}
94
- {"action":"B", "has_catalog_changes":"f"}
95
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":9,"tx":"1","ts":null,"jsb":null,"js":null,"ba":null}}
96
- {"action":"I","relation":["public","demo"],"newtuple":{"seq":10,"tx":"2","ts":null,"jsb":null,"js":null,"ba":null}}
97
- {"action":"C"}
98
- (27 rows)
73
+ SELECT * FROM get_startup_params();
74
+ key | value
75
+ ----------------------------------+--------
76
+ binary.binary_basetypes | "f"
77
+ binary.float4_byval | "t"
78
+ binary.float8_byval | "t"
79
+ binary.internal_basetypes | "f"
80
+ binary.sizeof_datum | "8"
81
+ binary.sizeof_int | "4"
82
+ binary.sizeof_long | "8"
83
+ coltypes | "f"
84
+ database_encoding | "UTF8"
85
+ encoding | "UTF8"
86
+ forward_changeset_origins | "f"
87
+ hooks.row_filter_enabled | "f"
88
+ hooks.shutdown_hook_enabled | "f"
89
+ hooks.startup_hook_enabled | "f"
90
+ hooks.transaction_filter_enabled | "f"
91
+ max_proto_version | "1"
92
+ min_proto_version | "1"
93
+ no_txinfo | "t"
94
+ relmeta_cache_size | "0"
95
+ (19 rows)
99
96
97
+ SELECT * FROM get_queued_data();
98
+ data
99
+ --------------------------------------------------------------------------------------------------------------------------------------------------------------
100
+ {"action": "B", "has_catalog_changes": "f"}
101
+ {"action": "I", "newtuple": {"ba": null, "js": null, "ts": null, "tx": "textval", "jsb": null, "seq": 1}, "relation": ["public", "demo"]}
102
+ {"action": "C"}
103
+ {"action": "B", "has_catalog_changes": "f"}
104
+ {"action": "I", "newtuple": {"ba": "\\xdeadbeef0001", "js": null, "ts": null, "tx": null, "jsb": null, "seq": 2}, "relation": ["public", "demo"]}
105
+ {"action": "C"}
106
+ {"action": "B", "has_catalog_changes": "f"}
107
+ {"action": "I", "newtuple": {"ba": null, "js": null, "ts": "2045-09-12T12:34:56", "tx": "blah", "jsb": null, "seq": 3}, "relation": ["public", "demo"]}
108
+ {"action": "C"}
109
+ {"action": "B", "has_catalog_changes": "f"}
110
+ {"action": "I", "newtuple": {"ba": null, "js": {"key": "value"}, "ts": null, "tx": null, "jsb": {"key": "value"}, "seq": 4}, "relation": ["public", "demo"]}
111
+ {"action": "C"}
112
+ {"action": "B", "has_catalog_changes": "f"}
113
+ {"action": "I", "newtuple": {"ba": null, "js": null, "ts": null, "tx": "row1", "jsb": null, "seq": 6}, "relation": ["public", "demo"]}
114
+ {"action": "I", "newtuple": {"ba": null, "js": null, "ts": null, "tx": "row2", "jsb": null, "seq": 7}, "relation": ["public", "demo"]}
115
+ {"action": "I", "newtuple": {"ba": null, "js": null, "ts": null, "tx": "row3", "jsb": null, "seq": 8}, "relation": ["public", "demo"]}
116
+ {"action": "D", "oldtuple": {"ba": null, "js": null, "ts": null, "tx": null, "jsb": null, "seq": 7}, "relation": ["public", "demo"]}
117
+ {"action": "U", "newtuple": {"ba": null, "js": null, "ts": null, "tx": "updated", "jsb": null, "seq": 6}, "relation": ["public", "demo"]}
118
+ {"action": "C"}
119
+ {"action": "B", "has_catalog_changes": "t"}
120
+ {"action": "I", "newtuple": {"id": 42}, "relation": ["public", "cat_test"]}
121
+ {"action": "C"}
122
+ {"action": "B", "has_catalog_changes": "f"}
123
+ {"action": "I", "newtuple": {"ba": null, "js": null, "ts": null, "tx": "1", "jsb": null, "seq": 9}, "relation": ["public", "demo"]}
124
+ {"action": "I", "newtuple": {"ba": null, "js": null, "ts": null, "tx": "2", "jsb": null, "seq": 10}, "relation": ["public", "demo"]}
125
+ {"action": "C"}
126
+ {"action": "B", "has_catalog_changes": "t"}
127
+ {"action": "C"}
128
+ (28 rows)
129
+
130
+ TRUNCATE TABLE json_decoding_output;
100
131
\i sql/basic_teardown.sql
101
132
SELECT 'drop' FROM pg_drop_replication_slot('regression_slot');
102
133
?column?
0 commit comments