You normally don't change id keys values.
PK/FK are not meant to be changed. That's the whole idea about id keys: values that say nothing about the data, so they should not change.
But if you have to, you could rely on ON triggers. And triggers have a history that doesn't recommend them for this job at all, keeping together the data integrity.