You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
4.0 KiB

Fixed problems found by valgrind Fixed problems in test suite where some test failed Fixed access to not initialized memory in federated Fixed access to not initialized memory when using BIT fields in internal temporary tables BitKeeper/etc/ignore: added libmysqld/sql_cursor.h mysql-test/r/information_schema.result: Change view names to 'v#' to not cause massive conflict with other tests if test dies in the middlecd mysql-test/r/information_schema_inno.result: Remove used tables at start mysql-test/r/multi_statement.result: Remove used tables at start mysql-test/r/temp_table.result: Change view names to 'v#' to not cause massive conflict with other tests if test dies in the middle mysql-test/r/type_bit.result: More tests mysql-test/t/information_schema.test: Change view names to 'v#' to not cause massive conflict with other tests if test dies in the middle mysql-test/t/information_schema_inno.test: Remove used tables at start mysql-test/t/multi_statement.test: Remove used tables at start mysql-test/t/temp_table.test: Change view names to 'v#' to not cause massive conflict with other tests if test dies in the middle mysql-test/t/type_bit.test: More tests mysql-test/valgrind.supp: Removed some valgrind warnings that isn't errors sql/ha_federated.cc: Fixed errors discovered by valgrind: - Socket was not initialized - share->scheme was deleted while there was still pointer into it from the hash sql/item_func.h: Remove access to table object from cleanup() as the table object may have been dropped earlier (In case of temporary tables or of close_thread_tables() is run before cleanup()) This fixed a bug with access to already freed memory sql/sql_base.cc: Reset variables used by fulltext sql/sql_select.cc: Fixed various problems with bit fields when used in internal temporary tables. Calculate space needed for bit fields correctly (previously we allocated more space than needed for rows in heap/myisam tables)
20 years ago
Don't display 'usage' privilege in TABLE_PRIVILEGES if we have columns privileges mysqldump skips information_schema db 'use' now can use information_schema db changed value of column 'Null' to 'NO' if column is not nullable client/mysqldump.c: mysqldump skips information_schema db mysql-test/r/alter_table.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/create.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ctype_collate.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ctype_recoding.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ctype_ujis.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/drop.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/func_sapdb.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/func_time.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/gis.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/information_schema.result: Added couple of tests mysql-test/r/information_schema_inno.result: Removed coulmn 'CONTRAINT_METOD' from TABLE_CONSTRAINTS Added column 'POSITION_IN_UNIQUE_CONSTRAINT' to KEY_COLUMN_USAGE mysql-test/r/innodb.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ndb_autodiscover.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ps_1general.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/rpl000009.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/rpl_create_database.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/schema.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/select.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/show_check.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/sp.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/type_enum.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/type_ranges.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/t/information_schema.test: Added couple of tests sql/sql_acl.cc: Don't display 'usage' privilege in TABLE_PRIVILEGES if we have columns privileges sql/sql_db.cc: 'use' now can use information_schema db sql/sql_show.cc: code cleanup informaton_schema(IS) db now contains data about IS itself sql/sql_yacc.yy: A fix(wrong behavour of 'SHOW COLUMNS, SHOW KEYS' with 'where condition')
21 years ago
  1. DROP TABLE IF EXISTS t1,t2,t3;
  2. CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
  3. CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id, id),
  4. FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE,
  5. FOREIGN KEY (t1_id) REFERENCES t1(id) ON UPDATE CASCADE) ENGINE=INNODB;
  6. CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT, INDEX par_ind (t2_id),
  7. FOREIGN KEY (id, t2_id) REFERENCES t2(t1_id, id) ON DELETE CASCADE) ENGINE=INNODB;
  8. select * from information_schema.TABLE_CONSTRAINTS where
  9. TABLE_SCHEMA= "test";
  10. CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
  11. NULL test PRIMARY test t1 PRIMARY KEY
  12. NULL test PRIMARY test t2 PRIMARY KEY
  13. NULL test t2_ibfk_1 test t2 FOREIGN KEY
  14. NULL test t2_ibfk_2 test t2 FOREIGN KEY
  15. NULL test PRIMARY test t3 PRIMARY KEY
  16. NULL test t3_ibfk_1 test t3 FOREIGN KEY
  17. select * from information_schema.KEY_COLUMN_USAGE where
  18. TABLE_SCHEMA= "test";
  19. CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
  20. NULL test PRIMARY NULL test t1 id 1 NULL NULL NULL NULL
  21. NULL test PRIMARY NULL test t2 id 1 NULL NULL NULL NULL
  22. NULL test t2_ibfk_1 NULL test t2 t1_id 1 1 test t1 id
  23. NULL test t2_ibfk_2 NULL test t2 t1_id 1 1 test t1 id
  24. NULL test PRIMARY NULL test t3 id 1 NULL NULL NULL NULL
  25. NULL test t3_ibfk_1 NULL test t3 id 1 1 test t2 t1_id
  26. NULL test t3_ibfk_1 NULL test t3 t2_id 2 2 test t2 id
  27. drop table t3, t2, t1;
  28. CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL,
  29. PRIMARY KEY(a1, a2)) ENGINE=INNODB;
  30. CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2),
  31. CONSTRAINT A1
  32. FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
  33. ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
  34. CREATE TABLE t3(b1 INT, b2 INT, INDEX t3_indx (b1, b2),
  35. CONSTRAINT A2
  36. FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
  37. ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
  38. CREATE TABLE t4(b1 INT, b2 INT, UNIQUE KEY t4_ukey (b1, b2),
  39. CONSTRAINT A3
  40. FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
  41. ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
  42. CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2),
  43. CONSTRAINT A4
  44. FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
  45. ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
  46. select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
  47. b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
  48. MATCH_OPTION, UPDATE_RULE, DELETE_RULE, b.REFERENCED_TABLE_NAME
  49. from information_schema.TABLE_CONSTRAINTS a,
  50. information_schema.REFERENTIAL_CONSTRAINTS b
  51. where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
  52. a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
  53. CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_TYPE CONSTRAINT_NAME UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE REFERENCED_TABLE_NAME
  54. test t2 FOREIGN KEY A1 test PRIMARY NONE CASCADE NO ACTION t1
  55. test t3 FOREIGN KEY A2 test b1 NONE SET NULL RESTRICT t2
  56. test t4 FOREIGN KEY A3 test t3_indx NONE NO ACTION SET NULL t3
  57. test t5 FOREIGN KEY A4 test t4_ukey NONE RESTRICT CASCADE t4
  58. drop tables t5, t4, t3, t2, t1;
  59. create database `db-1`;
  60. use `db-1`;
  61. create table `t-2` (
  62. id int(10) unsigned not null auto_increment,
  63. primary key (id)
  64. ) engine=innodb;
  65. create table `t-1` (
  66. id int(10) unsigned not null auto_increment,
  67. idtype int(10) unsigned not null,
  68. primary key (id),
  69. key fk_t1_1 (idtype),
  70. constraint fk_t1_1 foreign key (idtype) references `t-2` (id)
  71. ) engine=innodb;
  72. use test;
  73. select referenced_table_schema, referenced_table_name
  74. from information_schema.key_column_usage
  75. where constraint_schema = 'db-1';
  76. referenced_table_schema referenced_table_name
  77. NULL NULL
  78. db-1 t-2
  79. NULL NULL
  80. drop database `db-1`;
  81. create table t1(id int primary key) engine = Innodb;
  82. create table t2(pid int, foreign key (pid) references t1(id)) engine = Innodb;
  83. set foreign_key_checks = 0;
  84. drop table t1;
  85. select UNIQUE_CONSTRAINT_NAME
  86. from information_schema.referential_constraints
  87. where constraint_schema = schema();
  88. UNIQUE_CONSTRAINT_NAME
  89. NULL
  90. drop table t2;
  91. set foreign_key_checks = 1;