Bug #36369 Field flag GROUP_FLAG having same bit value as NUM_FLAG
Submitted: 28 Apr 2008 8:38 Modified: 15 Jun 2008 15:47
Reporter: Geert Vanderkelen Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0,5.1,6.0 OS:Any
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any
Tags: Contribution

[28 Apr 2008 8:38] Geert Vanderkelen
Really a small problem (aka nitpicking), but IMHO still an error. The GROUP_FLAG (used internally only apparently) has the same value as NUM_FLAG. It doesn't give problems of course, but it's still a little mistake there I think.
Or maybe the GROUP_FLAG is defined in the wrong place (which I don't think is the case..).

How to repeat:
Just checking the code in  include/mysql/mysql_com.h

/* The following are only sent to new clients */
#define ENUM_FLAG 256   /* field is an enum */
#define AUTO_INCREMENT_FLAG 512   /* field is a autoincrement field */
#define TIMESTAMP_FLAG  1024    /* Field is a timestamp */
#define SET_FLAG  2048    /* field is a set */
#define NO_DEFAULT_VALUE_FLAG 4096  /* Field doesn't have default value */

// Same as GROUP_FLAG
#define NUM_FLAG  32768   /* Field is num (for clients) */

#define PART_KEY_FLAG 16384   /* Intern; Part of some key */

#define GROUP_FLAG  32768   /* Intern: Group field */

#define UNIQUE_FLAG 65536   /* Intern: Used by sql_yacc */
#define BINCMP_FLAG 131072    /* Intern: Used by sql_yacc */

Suggested fix:
Set the GROUP_FLAG to something other than 1 << 24

(Also, it would be great having the value 'unified'. Either define them all using an integer, or all bit shifting, .. Makes hacking code easier, for making new client/server protocol implementations for example.)
[28 Apr 2008 8:40] Geert Vanderkelen
Small patch just changing the GROUP_FLAG constant value..

Attachment: GROUP_FLAG_fix.patch (, text), 1.06 KiB.

[28 Apr 2008 17:56] Sveta Smirnova
Thank you for the report.

Verified as described.