Support for any type primary key

Fixes #14194.