add function to get table's primary key
fix auto drop generated seq and trg using the correct primary key column name