Many government and academic institutions do in fact publicly publish all salaries, so the question of what the effect would be is not entirely theoretical.
Here's one place that aggregates this data: https://www.openthebooks.com/ https://www.openthebooks.com/virginia-state-employees/