When — When God, the maker and governor of this city shall take a survey of all his citizens. It is an allusion to princes or governors of cities that use to write and keep a register of all their people.
Related Commentaries of Psalms 87:6
Psalms 87:6
6 The LORD shall count, when he writeth up the people, that this man was born there. Selah.