Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> What's fishy about this is that I can't reproduce it locally in a
> variety of VMs, and the buildfarm is not unanimous either.
Well, as I said, I get
$ locale -a | grep ^aa_ER
aa_ER
aa_ER.utf8
aa_ER.utf8@saaho
aa_ER@saaho
What it looks like to me is that we see "aa_ER.utf8@saaho", enter
that, strip it to "aa_ER@saaho" and enter that (if_not_exists,
which it doesn't), and then see "aa_ER@saaho" which we try to
enter and fail. IOW, the behavior is dependent on the order in
which "locale -a" returns the names, which I already mentioned
I do not think we should trust to be consistent.
The previous coding applied a sort so as not to depend on what
order "locale -a" had returned things in, and I think we need
to retain that. At the very least, all the normalized names
need to be saved up and entered in a second pass.
regards, tom lane