Debian Codegraph @

mysql-test/suite/x/r/crud_update_merge_patch.result

raw
1 CREATE SCHEMA xtest;
2 #
3 # Requirement:
4 # * F8 - Must work for collections
5
6 command ok
7
8 # Implementations of test-cases from RFC 7396
9 #############################################
10 # It covers requirements from the worklog:
11 # * F3 - Must allow deletion of a field
12 # * F4 - Must allow setting the value of a field to
13 # a literal value
14 # * F6 - Must allow above operations to be performed on nested documents
15 # Verification of JSON patch [{"a": "b", "_id": 1} patch {"a": "c"} = {"a": "c", "_id": 1}]
16 Got expected error (code 0)
17
18 # Verification of JSON patch [{"a": "b", "_id": 1} patch {"b": "c"} = {"a": "b", "b": "c", "_id": 1}]
19 Got expected error (code 0)
20
21 # Verification of JSON patch [{"a": "b", "_id": 1} patch {"a": null} = {"_id": 1}]
22 Got expected error (code 0)
23
24 # Verification of JSON patch [{"a": "b", "b":"c", "_id": 1} patch {"a": null} = {"b": "c", "_id": 1}]
25 Got expected error (code 0)
26
27 # Verification of JSON patch [{"a": ["b"], "_id": 1} patch {"a": "c"} = {"a": "c", "_id": 1}]
28 Got expected error (code 0)
29
30 # Verification of JSON patch [{"a": "c", "_id": 1} patch {"a": ["b"]} = {"a": ["b"], "_id": 1}]
31 Got expected error (code 0)
32
33 # Verification of JSON patch [{"a": {"b":"c"}, "_id": 1} patch {"a": {"b":"d", "c": null}} = {"a": {"b": "d"}, "_id": 1}]
34 Got expected error (code 0)
35
36 # Verification of JSON patch [{"a": [{"b": "c"}], "_id": 1} patch {"a": [1]} = {"a": [1], "_id": 1}]
37 Got expected error (code 0)
38
39 # Test not applicable:
40 # doc:["a", "b"] patch:["c", "d"] result:["c", "d"]
41 # document can't be an array
42 in main, line 157:ERROR: Undefined macro DocumentProtobuf_OnlyTable_UpdatePatch_Find
43 # Test not applicable:
44 # doc:{} patch:["c", "d"] result:["c", "d"]
45 # document can't be an array
46 # Verification of JSON patch [{"a": "foo", "_id": 1} patch ["c"] = {"a": "foo", "_id": 1}]
47 Got expected error: Document is missing a required field (code 5115)
48
49 # Verification of JSON patch [{"a": "foo", "_id": 1} patch {"_id": "foo"} = {"a": "foo", "_id": 1}]
50 Got expected error (code 0)
51
52 # Verification of JSON patch [{"a": "foo", "_id": 1} patch null = {"a": "foo", "_id": 1}]
53 Got expected error: Document is missing a required field (code 5115)
54
55 # Verification of JSON patch [{"a": "foo", "_id": 1} patch "bar" = {"a": "foo", "_id": 1}]
56 Got expected error: Document is missing a required field (code 5115)
57
58 # Verification of JSON patch [{"e": null, "_id": 1} patch {"a": 1} = {"a": 1, "e": null, "_id": 1}]
59 Got expected error (code 0)
60
61 # Test not applicable:
62 # doc:[1, 2] patch:{"a": "b","c": null} result:{"a": "b"}
63 # document can't be an array
64 # Verification of JSON patch [{"_id": 1} patch {"a": "b", "c": null} = {"a": "b", "_id": 1}]
65 Got expected error (code 0)
66
67 # Verification of JSON patch [{"_id": 1} patch {"a": {"bb": {"ccc": null}}} = {"a": {"bb": {}}, "_id": 1}]
68 Got expected error (code 0)
69
70 # Verification of JSON patch [{"_id": 1} patch PROTOBUF_EXPR = {"_id": 1, "my_value_as_int": 10, "my_value_as_string": "ten"}]
71 Got expected error (code 0)
72
73 # Verification of JSON patch [{"a":20, "_id": 1} patch PROTOBUF_EXPR = {"a": 20, "b": 10, "c": 40.0, "_id": 1}]
74 Got expected error (code 0)
75
76 # Verification of JSON patch [{"_id": 1, "old_field_name": {"field": "fields value"}, "other_fields": {"a": 1}} patch PROTOBUF_EXPR = {"_id": 1, "other_fields": {"a": 1}, "new_field_name": {"field": "fields value"}}]
77 Got expected error (code 0)
78
79 # Verification of JSON patch [{"_id": 1, "a": [100, {"c": "nested_value"}, 4]} patch PROTOBUF_EXPR = {"a": [100, {"c": "nested_value"}, 4], "_id": 1, "new_field": "nested_value"}]
80 Got expected error (code 0)
81
82 # Verification of JSON patch [{"_id": 1, "old_field": true} patch PROTOBUF_EXPR = {"_id": 1, "old_field": true, "func_call1": "xtest", "func_call2": "AB"}]
83 Got expected error (code 0)
84
85
86 3 rows affected
87 Rows matched: 3 Changed: 3 Warnings: 0
88 send Mysqlx.Crud.Find {
89 collection {
90 name: "xdoc"
91 }
92 data_model: DOCUMENT
93 }
94
95 doc
96 {"_id": 1, "new_field": 10, "should_be_updated": "yes"}
97 {"_id": 2, "new_field": 10, "should_be_updated": "yes"}
98 {"_id": 3, "should_be_updated": "no"}
99 {"_id": 4, "should_be_updated": "no"}
100 {"_id": 5, "should_be_updated": "no"}
101 {"_id": 6, "new_field": 10, "should_be_updated": "yes"}
102 command ok
103 Mysqlx.Ok {
104 msg: "bye!"
105 }
106 ok
107 #
108 # Requirement:
109 # * F10 - Must work for JSON document fields in tables
110 RUN DROP TABLE IF EXISTS xtest.xdoc
111
112 0 rows affected
113 RUN CREATE TABLE xtest.xdoc(doc JSON)
114
115 0 rows affected
116
117 # Implementations of test-cases from RFC 7396
118 #############################################
119 # It covers requirements from the worklog:
120 # * F3 - Must allow deletion of a field
121 # * F4 - Must allow setting the value of a field to
122 # a literal value
123 # * F6 - Must allow above operations to be performed on nested documents
124 # Verification of JSON patch [{"a": "b", "_id": 1} patch {"a": "c"} = {"a": "c", "_id": 1}]
125 Got expected error (code 0)
126
127 # Verification of JSON patch [{"a": "b", "_id": 1} patch {"b": "c"} = {"a": "b", "b": "c", "_id": 1}]
128 Got expected error (code 0)
129
130 # Verification of JSON patch [{"a": "b", "_id": 1} patch {"a": null} = {"_id": 1}]
131 Got expected error (code 0)
132
133 # Verification of JSON patch [{"a": "b", "b":"c", "_id": 1} patch {"a": null} = {"b": "c", "_id": 1}]
134 Got expected error (code 0)
135
136 # Verification of JSON patch [{"a": ["b"], "_id": 1} patch {"a": "c"} = {"a": "c", "_id": 1}]
137 Got expected error (code 0)
138
139 # Verification of JSON patch [{"a": "c", "_id": 1} patch {"a": ["b"]} = {"a": ["b"], "_id": 1}]
140 Got expected error (code 0)
141
142 # Verification of JSON patch [{"a": {"b":"c"}, "_id": 1} patch {"a": {"b":"d", "c": null}} = {"a": {"b": "d"}, "_id": 1}]
143 Got expected error (code 0)
144
145 # Verification of JSON patch [{"a": [{"b": "c"}], "_id": 1} patch {"a": [1]} = {"a": [1], "_id": 1}]
146 Got expected error (code 0)
147
148 # Verification of JSON patch [["a", "b"] patch ["c", "d"] = ["c", "d"]]
149 Got expected error (code 0)
150
151 in main, line 157:ERROR: Undefined macro DocumentProtobuf_OnlyTable_UpdatePatch_Find
152 # Verification of JSON patch [{} patch ["c", "d"] = ["c", "d"]]
153 Got expected error (code 0)
154
155 # Verification of JSON patch [{"a": "foo", "_id": 1} patch ["c"] = ["c"]]
156 Got expected error (code 0)
157
158 # Verification of JSON patch [{"a": "foo", "_id": 1} patch {"_id": "foo"} = {"a": "foo", "_id": "foo"}]
159 Got expected error (code 0)
160
161 # Verification of JSON patch [{"a": "foo", "_id": 1} patch null = null]
162 Got expected error (code 0)
163
164 # Verification of JSON patch [{"a": "foo", "_id": 1} patch "bar" = "bar"]
165 Got expected error (code 0)
166
167 # Verification of JSON patch [{"e": null, "_id": 1} patch {"a": 1} = {"a": 1, "e": null, "_id": 1}]
168 Got expected error (code 0)
169
170 # Verification of JSON patch [[1, 2] patch {"a": "b","c": null} = {"a": "b"}]
171 Got expected error (code 0)
172
173 # Verification of JSON patch [{"_id": 1} patch {"a": "b", "c": null} = {"a": "b", "_id": 1}]
174 Got expected error (code 0)
175
176 # Verification of JSON patch [{"_id": 1} patch {"a": {"bb": {"ccc": null}}} = {"a": {"bb": {}}, "_id": 1}]
177 Got expected error (code 0)
178
179 # Verification of JSON patch [{"_id": 1} patch PROTOBUF_EXPR = {"_id": 1, "my_value_as_int": 10, "my_value_as_string": "ten"}]
180 Got expected error (code 0)
181
182 # Verification of JSON patch [{"a":20, "_id": 1} patch PROTOBUF_EXPR = {"a": 20, "b": 10, "c": 40.0, "_id": 1}]
183 Got expected error (code 0)
184
185 # Verification of JSON patch [{"_id": 1, "old_field_name": {"field": "fields value"}, "other_fields": {"a": 1}} patch PROTOBUF_EXPR = {"_id": 1, "other_fields": {"a": 1}, "new_field_name": {"field": "fields value"}}]
186 Got expected error (code 0)
187
188 # Verification of JSON patch [{"_id": 1, "a": [100, {"c": "nested_value"}, 4]} patch PROTOBUF_EXPR = {"a": [100, {"c": "nested_value"}, 4], "_id": 1, "new_field": "nested_value"}]
189 Got expected error (code 0)
190
191 # Verification of JSON patch [{"_id": 1, "old_field": true} patch PROTOBUF_EXPR = {"_id": 1, "old_field": true, "func_call1": "xtest", "func_call2": "AB"}]
192 Got expected error (code 0)
193
194
195 3 rows affected
196 Rows matched: 3 Changed: 3 Warnings: 0
197 send Mysqlx.Crud.Find {
198 collection {
199 name: "xdoc"
200 }
201 data_model: TABLE
202 }
203
204 doc
205 {"_id": 1, "new_field": 10, "should_be_updated": "yes"}
206 {"_id": 2, "new_field": 10, "should_be_updated": "yes"}
207 {"_id": 3, "should_be_updated": "no"}
208 {"_id": 4, "should_be_updated": "no"}
209 {"_id": 5, "should_be_updated": "no"}
210 {"_id": 6, "new_field": 10, "should_be_updated": "yes"}
211 command ok
212 Mysqlx.Ok {
213 msg: "bye!"
214 }
215 ok