Is it bad social etiquette to ask a colleague their salary?

Is it bad social etiquette to ask a colleague their salary; whether or not they work at the same company or just have a similar job at a different company?

And asking would be to wonder if your own salary is fair.