I would like to use a unique identifier in WordPress instead of the autoincrement idea which is the WP standard approach, to facilitate integration with other applications.
It is fairly straightforward to do this by overriding the "insert_replace" helper function and the query function in wpdb with functions in a new class which set and remember a unique value to be used as a primary key.
The trouble starts when WP retrieves the primary key, and casts it as an integer. In order to ensure a reasonable chance of the key being unique, I am using PHP's uniqid() function, and converting the hex result to base 10. In PHP, this is a float, because a PHP integer is limited to 2 billion odd, and the unique id is way bigger.
All the primary keys in WP are defined as BIGINT, so MySQL has no difficulty in managing the larger value.
Question is what is the logic in defining the database column as BIGINT and then casting the value returned from the database to INT? More to the point, am I going to get into major trouble somewhere along the line if I remove all the "(int)" castings in the WP core?
I would really prefer not to hack the core at all for all the obvious reasons: is there any other way to work around this?