> I forget which Scandinavian country this is true for but I think there exists a country where compensation is a matter of public record.
It's Sweden.
It's Sweden.
Edit: more info in Swedish here: https://lawline.se/answers/ar-inkomstdeklarationer-allmanna-...
The tax you pay is public record.
For example, in Sweden, you can get a 'tax calendar' (a bit like an old-fashioned phonebook, but with total pay instead of phone numbers). You can buy relevant pages conveniently online.
https://en.wikipedia.org/wiki/Taxeringskalendern
It is a trivial division-by-twelve to determine the salary of your co-workers and neighbours.