$pkey should be the primary key of the real table, not the history table.