add new feature: auto_detect primary keys