-
Notifications
You must be signed in to change notification settings - Fork 0
/
type-1.txt
141 lines (131 loc) · 2.6 KB
/
type-1.txt
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
136
137
138
139
140
141
#Insert
insert into students values (2, 'Ak');
{
"xid": 683,
"change": [
{
"kind": "insert",
"schema": "public",
"table": "students",
"columnnames": ["id", "name"],
"columntypes": ["integer", "character varying(255)"],
"columnvalues": [2, "Ak"]
}
]
}
#update
update students set name = 'ABC' where id = 2;
{
"xid": 684,
"change": [
{
"kind": "update",
"schema": "public",
"table": "students",
"columnnames": ["id", "name"],
"columntypes": ["integer", "character varying(255)"],
"columnvalues": [2, "ABC"],
"oldkeys": {
"keynames": ["id"],
"keytypes": ["integer"],
"keyvalues": [2]
}
}
]
}
Transaction:
begin;
update students set name = 'dinsaw' where id = 1;
update students set name = 'ab' where id = 2;
update student_admissions set standard = '10' where id =1;
commit;
{
"xid": 687,
"change": [
{
"kind": "update",
"schema": "public",
"table": "students",
"columnnames": ["id", "name"],
"columntypes": ["integer", "character varying(255)"],
"columnvalues": [1, "dinsaw"],
"oldkeys": {
"keynames": ["id"],
"keytypes": ["integer"],
"keyvalues": [1]
}
}
,{
"kind": "update",
"schema": "public",
"table": "students",
"columnnames": ["id", "name"],
"columntypes": ["integer", "character varying(255)"],
"columnvalues": [2, "ab"],
"oldkeys": {
"keynames": ["id"],
"keytypes": ["integer"],
"keyvalues": [2]
}
}
,{
"kind": "update",
"schema": "public",
"table": "student_admissions",
"columnnames": ["id", "student_id", "standard"],
"columntypes": ["integer", "integer", "character varying(255)"],
"columnvalues": [1, 1, "10"],
"oldkeys": {
"keynames": ["id"],
"keytypes": ["integer"],
"keyvalues": [1]
}
}
]
}
begin;
delete from student_admissions where student_id = 1;
delete from students where id=1;
commit;
{
"xid": 689,
"change": [
{
"kind": "delete",
"schema": "public",
"table": "student_admissions",
"oldkeys": {
"keynames": ["id"],
"keytypes": ["integer"],
"keyvalues": [1]
}
}
,{
"kind": "delete",
"schema": "public",
"table": "students",
"oldkeys": {
"keynames": ["id"],
"keytypes": ["integer"],
"keyvalues": [1]
}
}
]
}
With Timestamp
insert into students values (3, 'Bk');
{
"xid": 703,
"timestamp": "2020-02-05 17:47:41.637863+05:30",
"change": [
{
"kind": "insert",
"schema": "public",
"table": "students",
"columnnames": ["id", "name"],
"columntypes": ["integer", "character varying(255)"],
"columnvalues": [3, "Bk"]
}
]
}
LastReceivedLSN =LSN{0/17A1B80}