Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> These OIDs are constraint OIDs, not relation OIDs, so the regclass
> cast just renders them as numeric strings, and comparing those as text
> depends on the number of digits. Once the OID counter crosses a power
> of ten while the test runs, '1000006' sorts before '999987' and the
> output order flips.
Right, that's bogus.
> I plan to push the attached patch to fix it. Any thoughts?
This is only somewhat less bogus, though: it'd still fail at OID
wraparound. How about sorting by the constraint name?
regards, tom lane