forked from eulerto/wal2json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypmod.out
136 lines (132 loc) · 21.6 KB
/
typmod.out
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
\set VERBOSITY terse
-- predictability
SET synchronous_commit = on;
SET extra_float_digits = 0;
DROP TABLE IF EXISTS table_with_pk;
CREATE TABLE table_with_pk (
a smallserial,
b smallint,
c int,
d bigint,
e numeric(5,3),
f real not null,
g double precision,
h char(10),
i varchar(30),
j text,
k bit varying(20),
l timestamp,
m date,
n boolean not null,
o json,
p tsvector,
PRIMARY KEY(b, c, d)
);
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'wal2json');
?column?
----------
init
(1 row)
INSERT INTO table_with_pk (b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) VALUES(1, 2, 3, 3.54, 876.563452345, 1.23, 'teste', 'testando', 'um texto longo', B'001110010101010', '2013-11-02 17:30:52', '2013-02-04', true, '{ "a": 123 }', 'Old Old Parr'::tsvector);
UPDATE table_with_pk SET f = -f WHERE b = 1;
-- UPDATE: pk change
DELETE FROM table_with_pk WHERE b = 1;
SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'format-version', '1', 'pretty-print', '1');
data
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{ +
"change": [ +
{ +
"kind": "insert", +
"schema": "public", +
"table": "table_with_pk", +
"columnnames": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"], +
"columntypes": ["smallint", "smallint", "integer", "bigint", "numeric(5,3)", "real", "double precision", "character(10)", "character varying(30)", "text", "bit varying(20)", "timestamp without time zone", "date", "boolean", "json", "tsvector"],+
"columnvalues": [1, 1, 2, 3, 3.540, 876.563, 1.23, "teste ", "testando", "um texto longo", "001110010101010", "Sat Nov 02 17:30:52 2013", "02-04-2013", true, "{ \"a\": 123 }", "'Old' 'Parr'"] +
} +
] +
}
{ +
"change": [ +
{ +
"kind": "update", +
"schema": "public", +
"table": "table_with_pk", +
"columnnames": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"], +
"columntypes": ["smallint", "smallint", "integer", "bigint", "numeric(5,3)", "real", "double precision", "character(10)", "character varying(30)", "text", "bit varying(20)", "timestamp without time zone", "date", "boolean", "json", "tsvector"],+
"columnvalues": [1, 1, 2, 3, 3.540, -876.563, 1.23, "teste ", "testando", "um texto longo", "001110010101010", "Sat Nov 02 17:30:52 2013", "02-04-2013", true, "{ \"a\": 123 }", "'Old' 'Parr'"], +
"oldkeys": { +
"keynames": ["b", "c", "d"], +
"keytypes": ["smallint", "integer", "bigint"], +
"keyvalues": [1, 2, 3] +
} +
} +
] +
}
{ +
"change": [ +
{ +
"kind": "delete", +
"schema": "public", +
"table": "table_with_pk", +
"oldkeys": { +
"keynames": ["b", "c", "d"], +
"keytypes": ["smallint", "integer", "bigint"], +
"keyvalues": [1, 2, 3] +
} +
} +
] +
}
(3 rows)
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'format-version', '1', 'pretty-print', '1', 'include-typmod', '0');
data
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{ +
"change": [ +
{ +
"kind": "insert", +
"schema": "public", +
"table": "table_with_pk", +
"columnnames": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"], +
"columntypes": ["int2", "int2", "int4", "int8", "numeric", "float4", "float8", "bpchar", "varchar", "text", "varbit", "timestamp", "date", "bool", "json", "tsvector"], +
"columnvalues": [1, 1, 2, 3, 3.540, 876.563, 1.23, "teste ", "testando", "um texto longo", "001110010101010", "Sat Nov 02 17:30:52 2013", "02-04-2013", true, "{ \"a\": 123 }", "'Old' 'Parr'"] +
} +
] +
}
{ +
"change": [ +
{ +
"kind": "update", +
"schema": "public", +
"table": "table_with_pk", +
"columnnames": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"], +
"columntypes": ["int2", "int2", "int4", "int8", "numeric", "float4", "float8", "bpchar", "varchar", "text", "varbit", "timestamp", "date", "bool", "json", "tsvector"], +
"columnvalues": [1, 1, 2, 3, 3.540, -876.563, 1.23, "teste ", "testando", "um texto longo", "001110010101010", "Sat Nov 02 17:30:52 2013", "02-04-2013", true, "{ \"a\": 123 }", "'Old' 'Parr'"],+
"oldkeys": { +
"keynames": ["b", "c", "d"], +
"keytypes": ["int2", "int4", "int8"], +
"keyvalues": [1, 2, 3] +
} +
} +
] +
}
{ +
"change": [ +
{ +
"kind": "delete", +
"schema": "public", +
"table": "table_with_pk", +
"oldkeys": { +
"keynames": ["b", "c", "d"], +
"keytypes": ["int2", "int4", "int8"], +
"keyvalues": [1, 2, 3] +
} +
} +
] +
}
(3 rows)
SELECT 'stop' FROM pg_drop_replication_slot('regression_slot');
?column?
----------
stop
(1 row)