Bug #16000 CREATE TABLE produces "Incorrect information in file" msg, leaves a junk file
Submitted: 27 Dec 2005 5:43 Modified: 23 Jun 2006 6:19
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1-bk OS:
Assigned to: Mikael Ronström CPU Architecture:Any

[27 Dec 2005 5:43] Sergey Petrunya
Description:
Running a CREATE TABLE that produces 
"The PARTITION function returns the wrong type" error also causes an 
"Incorrect information in file" to be printed to the server stderr,
and a junk file is left in the database directory.

How to repeat:
Run the following statement:

mysql> create table u10 (a char(10)) partition by HASH(a) partitions 2;
ERROR 1469 (HY000): The PARTITION function returns the wrong type

Then look at server stderr output and find there a message like

051227  1:27:32 [ERROR] /home/psergey/mysql-5.1-ppruning-r4/sql/mysqld: Incorrect information in file: './test10/u10.frm'

Also look into $DATADIR/$database directory and see that "u10.par" file is
left there.

Suggested fix:
Don't write useless messages to stderr, don't leave junk files.
[27 Dec 2005 13:05] Aleksey Kishkin
actually I got sigsegv on that query (mysql5.1.5 from bk tree):

0x81ae0da handle_segfault + 680
0x4018d715 _end + 933550085
0x81ef82f _Z12setup_tablesP3THDP23Name_resolution_contextP4ListI13st_table_listEPS4_PP4ItemPS7_b + 131
0x81f85ec _ZN4JOIN7prepareEPPP4ItemP13st_table_listjS1_jP8st_orderS7_S1_S7_P13st_select_lexP18st_select_lex_unit + 240
0x818102f _ZN30subselect_single_select_engine7prepareEv + 309
0x817d9b3 _ZN14Item_subselect10fix_fieldsEP3THDPP4Item + 109
0x814a565 _ZN9Item_func10fix_fieldsEP3THDPP4Item + 401
0x812d7f6 _Z20fix_fields_part_funcP3THDP13st_table_listP4ItemP14partition_infob + 168
0x812a2b4 _Z18fix_partition_funcP3THDPKcP8st_table + 1090
0x81f4e83 _Z21open_table_from_shareP3THDP14st_table_sharePKcjjjP8st_table + 1123
0x81ed38a _Z17open_unireg_entryP3THDP8st_tableP13st_table_listPKcPcjP11st_mem_root + 138
0x81ec80f _Z10open_tableP3THDP13st_table_listP11st_mem_rootPbj + 1939
0x81eda6a _Z11open_tablesP3THDPP13st_table_listPjj + 596
0x81edf73 _Z30open_normal_and_derived_tablesP3THDP13st_table_listj + 41
0x827db77 _Z18mysqld_list_fieldsP3THDP13st_table_listPKc + 35
0x81c272c _Z16dispatch_command19enum_server_commandP3THDPcj + 2298
0x81c1de6 _Z10do_commandP3THD + 154
0x81c1177 handle_one_connection + 449
0x401884eb _end + 933529051
0x402f1b0a _end + 935009274
[27 Dec 2005 13:09] Aleksey Kishkin
sorry previous crash was just a fluence of another bug testing. please disregard my previos  stacktrace.

mysql> create table u10 (a char(10)) partition by HASH(a) partitions 2;
ERROR 1469 (HY000): The PARTITION function returns the wrong type

verified.
[15 Apr 2006 9:21] Mikael Ronström
This bug is a consequence of that it isn't possible to call fix_fields on the Item tree of the
partition function until a frm file has been created and the frm file read such that we get
a table object. Only then is it possible to make checks that everything with partitioning
actually fits together. However the code for reading frm files generates Incorrect information
messages to the error message file as part of this. This needs somehow to be taken care of
to avoid that to happen.
[20 Jun 2006 14:21] Alexander Barkov
The patch "5.1 tree (mikael:1.2220) BUG#16000" looks ok to push.
[22 Jun 2006 7:22] Mikael Ronström
Patch will appear in 5.1.12
This also fixes duplicate bug#19813
[23 Jun 2006 6:19] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented bugfix in 5.1.12 changelog; closed.