Why does entity rename create new row in states_meta table?

I’m just learning a bit of the internals and db structure.

I renamed an entity using the UI and I kind of expected the row in the states_meta would be updated, which would have kept the state rows pointing to the same entity.

I changed switch.esp_24_relay_01 to switch.sprinkler_valve_01 in the UI, and the new entity id was added to the table instead of updated. I’m curious why.

I assumed the point of the *_meta tables were to allow for updating a name in one table and then all the referencing rows would still point to same entity.

sqlite> select * from states_meta where entity_id in ('switch.esp_24_relay_01','switch.sprinkler_valve_01');
metadata_id  entity_id
-----------  -------------------------
5057         switch.esp_24_relay_01
5145         switch.sprinkler_valve_01

Here you can see there’s still state rows pointing to the old name:

sqlite> select metadata_id, count(*) from states where metadata_id in (5057,5145) group by 1;
metadata_id  count(*)
-----------  --------
5057         46
5145         1

I know the states table will get purged out over time, but do I now have an orphaned row in the states_meta table?

Just curious about this. Thanks.