"Jimmy Thrasher" <jimmy@jimmythrasher.com> writes:
> As I understand it, postgresql sorts strings roughly like strcmp does: character by character based on encoding
value.
Only if you're using C locale. Other locales such as en_US have
completely different rules, which most hackers tend to find pretty
unintelligible and inconsistent :-(. In your example, I think
the first-pass sort is on just the letters, and only if those are
the same will it consider the punctuation.
regards, tom lane