You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#12581895 - ndbinfo should support opening tables with more or differently named columns
- Add support for opening a table with more fields than exist in NDBINFO,
all fields not sent by NDB will be set to NULL
- Add check to prevent opening a table with fields which are NOT NULL
- Extend NdbInfoRecAttr with isNULL()
Copy file name to clipboardExpand all lines: mysql-test/suite/ndb/r/ndbinfo.result
+63-8Lines changed: 63 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -180,20 +180,55 @@ node_id != 0
180
180
1
181
181
Warnings:
182
182
Warning 40001 Table 'ndb$test' is defined differently in NDB, there are more columns available. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
183
-
184
-
## 2) Column does not exist in NDB -> error, with warning
185
183
DROP TABLE ndb$test;
184
+
185
+
## 2) Column does not exist in NDB -> allowed, with warning, non existing
ERROR HY000: Got error 40001 'Incompatible table definitions' from NDBINFO
189
-
SHOW WARNINGS;
190
-
Level Code Message
189
+
SELECT DISTINCT node_id, non_existing FROM ndb$test;
190
+
node_id non_existing
191
+
1 NULL
192
+
2 NULL
193
+
Warnings:
191
194
Error 40001 Table 'ndb$test' is defined differently in NDB, column 'non_existing' does not exist. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
192
-
Error 1296 Got error 40001 'Incompatible table definitions' from NDBINFO
195
+
Warning 40001 Table 'ndb$test' is defined differently in NDB, there are more columns available. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
196
+
DROP TABLE ndb$test;
197
+
198
+
## 2b) Extra column(s) in middle
199
+
CREATE TABLE ndb$test (
200
+
node_id int unsigned,
201
+
non_existing int unsigned,
202
+
block_number int unsigned,
203
+
block_instance int unsigned,
204
+
counter int unsigned,
205
+
counter2 bigint unsigned
206
+
) ENGINE = ndbinfo;
207
+
SELECT DISTINCT node_id, non_existing, block_number FROM ndb$test;
208
+
node_id non_existing block_number
209
+
1 NULL 249
210
+
2 NULL 249
211
+
Warnings:
212
+
Error 40001 Table 'ndb$test' is defined differently in NDB, column 'non_existing' does not exist. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
SELECT DISTINCT node_id, non_existing FROM ndb$test;
218
+
node_id non_existing
219
+
1 NULL
220
+
2 NULL
221
+
Warnings:
222
+
Error 40001 Table 'ndb$test' is defined differently in NDB, column 'non_existing' does not exist. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
223
+
Warning 40001 Table 'ndb$test' is defined differently in NDB, there are more columns available. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
224
+
SELECT DISTINCT non_existing, node_id FROM ndb$test;
225
+
non_existing node_id
226
+
NULL 1
227
+
NULL 2
228
+
DROP TABLE ndb$test;
193
229
194
230
## 3) Incompatible column type -> error, with warning
ERROR HY000: Got error 40001 'Incompatible table definitions' from NDBINFO
@@ -220,6 +255,26 @@ Level Code Message
220
255
Error 40001 Table 'ndb$test' is defined differently in NDB, column 'node_id' is not compatible. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
221
256
Error 1296 Got error 40001 'Incompatible table definitions' from NDBINFO
222
257
DROP TABLE ndb$test;
258
+
## 3d) column which is NOT NULL
259
+
CREATE TABLE ndb$test (node_id int unsigned NOT NULL) ENGINE = ndbinfo;
260
+
SELECT * FROM ndb$test;
261
+
ERROR HY000: Got error 40001 'Incompatible table definitions' from NDBINFO
262
+
SHOW WARNINGS;
263
+
Level Code Message
264
+
Error 40001 Table 'ndb$test' is defined differently in NDB, column 'node_id' is NOT NULL. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
265
+
Error 1296 Got error 40001 'Incompatible table definitions' from NDBINFO
266
+
DROP TABLE ndb$test;
267
+
## 3e) non existing column which is NOT NULL
268
+
CREATE TABLE ndb$test (
269
+
block_number int unsigned,
270
+
non_existing int NOT NULL) ENGINE = ndbinfo;
271
+
SELECT * FROM ndb$test;
272
+
ERROR HY000: Got error 40001 'Incompatible table definitions' from NDBINFO
273
+
SHOW WARNINGS;
274
+
Level Code Message
275
+
Error 40001 Table 'ndb$test' is defined differently in NDB, column 'non_existing' is NOT NULL. The SQL to regenerate is: 'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED, `block_number` INT UNSIGNED, `block_instance` INT UNSIGNED, `counter` INT UNSIGNED, `counter2` BIGINT UNSIGNED) ENGINE=NDBINFO'
276
+
Error 1296 Got error 40001 'Incompatible table definitions' from NDBINFO
277
+
DROP TABLE ndb$test;
223
278
224
279
## 4) Table with primary key/indexes not supported
0 commit comments