Fix #12728 - Use proper pk column for postgresql when setting sequences

PostgreSQL was hard-coded to use the 'id' column when generating SQL to set the sequence on the models of many-to-many relations. This breaks when the relation uses table-based inheritence, where the primary key will not be named 'id'.

This change uses the actual primary key column name.

Fix for https://code.djangoproject.com/ticket/12728