Bug #36621 Falcon allows a key to be named PRIMARY_KEY
Submitted: 9 May 2008 10:49 Modified: 20 Jun 2008 21:43
Reporter: Philip Stoev Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.5 OS:Any
Assigned to: Ann Harrison CPU Architecture:Any

[9 May 2008 10:49] Philip Stoev
Description:
It appears that Falcon uses PRIMARY_KEY as the name of its internal primary key, as seen in debug log messages such as:

Exception: duplicate values for key TB1_ENG1#P#PART1..PRIMARY_KEY in table SYSTEST1.TB1_ENG1#P#PART1

However, mysql would allow a table to be created where PRIMARY_KEY is a valid secondary key name. I am concerned that a mix-up may happen in Falcon's internal structures due to duplicate key names.

On the other hand, MySQL does not allow a key to be named PRIMARY, so maybe Falcon should drop the _KEY suffix and switch to that name in order to benefit from this protection.

How to repeat:
mysql> create table t1 (f1 integer not null, f2 integer not null, primary key (f1), key `PRIMARY` (f1,f2)) engine=falcon;
ERROR 1280 (42000): Incorrect index name 'PRIMARY'

mysql> create table t1 (f1 integer not null, f2 integer not null, primary key (f1), key `PRIMARY_KEY` (f1,f2)) engine=falcon;
Query OK, 0 rows affected (0.02 sec)

Suggested fix:
Name Falcon's primary key PRIMARY rather than PRIMARY_KEY , if there is a potential for a mix-up.
[20 Jun 2008 21:43] Ann Harrison
Internally, Falcon uses a two-level name space.  System objects are
part of the System schema, and can not be confused with user objects,
even if they have the same unqualified name.