A while ago I blogged about a potential workaround for MySQL
error 1070 that could be used to add a unique constraint with
more than 16 columns.
As a reminder here's the error you get when you try to create a
unique constraint with more than 16 columns in MySQL:
ERROR 1070 (42000): Too many key parts specified; max 16
parts allowed
The solution I proposed should work, but when I started to
implement it I made a couple of changes that merit this follow-up
post. One change is fairly generic, and the other is specific to
my use case.
The generic change was to only concatenate some of the
columns, rather than all of them. Specifically I only need to
concatenate N-15 columns. So if I want to have a unique
constraint on 20 columns, I can include 15 of those actual
columns and then …
[Read more]