#4011 indexes are combined when using edit table popup

4.0.4
wont-fix
Marc Delisle
5
2013-09-10
2013-07-09
No

When adding new columns/fields to a table with the edit table popup, and selecting the 'INDEX' option for some of them (at least two), a combined index is created. I would expect separate (one per column/field) indexes to be created.
If someone would like to have indexes spanning different columns, they can use the index editor, I assume using multicolumn/field indexes is more advanced than single column/field indexes.

What's currently happening :

ALTER TABLE table ADD field1 VARCHAR( 8 ) NOT NULL,
ADD field2 CHAR( 2 ) NOT NULL,
ADD INDEX ( field1 , field2 ) ;

What should happen by default :

ALTER TABLE table ADD field1 VARCHAR( 8 ) NOT NULL,
ADD field2 CHAR( 2 ) NOT NULL,
ADD INDEX ( field1 ),
ADD INDEX ( field2 ) ;

Discussion

  • Marc Delisle
    Marc Delisle
    2013-08-05

    • assigned_to: Marc Delisle
     
  • Marc Delisle
    Marc Delisle
    2013-08-05

    Dieter,
    This happens also when creating a table. I have been reluctant to change this because it has been the default for so many years, but it's possibly an unexpected default.

    However, what should we do if someone selects PRIMARY for both columns? Would this mean a combined index? Or should we treat this as an error?

     
  • Marc Delisle
    Marc Delisle
    2013-09-10

    Any feedback?

     
  • I was expecting to have two separate indexes (one for each column), when I indicate for both columns that I wanted them to be indexed. But as you mention, someone who would want a combined index for both tables, might expect this to happen as well by selecting both columns.

    The same for a PRIMARY. A combined PRIMARY for two separate columns is allowed, AFAIK, so it shouldn't throw an error.

    If there were no other reports about this, it's probably better to keep it as it is.

     
    • status: open --> wont-fix