Looking at Bug#47310, which is a feature request that I hear
frequently when I talk about partitions, I wrote a comment,
suggesting triggers to work around the limitation.
The reason for the limitation is that allowing arbitrary
functions for partitioning was too complex and it was provoking
crashes and other unpleasant side effects (see the discussion
under bug#18198).
But if you use a trigger, the resulting column is a plain
integer, and many of the side effects disappear. The drawback is
that you need to add a column to your table, and you need
to use that column when searching for data. With that in mind,
you can implement the workaround quite easily.
[Read more]
USE test;
DROP TABLE IF EXISTS users;
CREATE TABLE users (
user_id int(10) NOT NULL,
…