Bug #12009 Insert into Merge table does not enforce base table defaults
Submitted: 18 Jul 2005 14:33 Modified: 20 Jul 2005 21:07
Reporter: Theresa Pitts Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Any (*)
Assigned to: Ingo Strüwing CPU Architecture:Any

[18 Jul 2005 14:33] Theresa Pitts
A base table is created with a default on a column.  A merge table is created that references that base table.  When an insert is done on the merge table, the underlying default is not enforced.

How to repeat:
create table t1 (f1 int not null, f2 char(5) default 'abcde', primary key (f1)) type = MYISAM;

create table mt1 (f1 int not null, f2 char(5), primary key (f1)) type = MERGE UNION = (t1) INSERT_METHOD=LAST;

insert t1 (f1) values (1);

insert mt1 (f1) values (2);


| f1 | f2       |
|  1 | abcde |
|  2 | NULL  |

Suggested fix:
Merge table should enforce underlying defaults.
[20 Jul 2005 21:07] Sergei Golubchik
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

No, it should not. You insert into the table mt1, so whatever default values are specified in *this* table definition are used. Besides, it's generally a bad idea to have a merge table that is defined differently from underlying myisam tables.