PG Bug reporting form <noreply@postgresql.org> writes:
> postgres=# select * from bint order by a[2] desc limit 5;
> a
> ---------------
> {14}
> {10}
> {14}
> {10,14,10,10}
> {10,14,14,14}
> (5 rows)
You failed to say what you think is a bug here, but I'm going
to guess that you're unhappy that this is not the same as
the first five rows of the not-limited sort output. We do not
consider that a bug, because the sort key is very underspecified
here. The first three rows share the same sort key (null) and
can legitimately come out in any order. Likewise, rows with
a[2] = 14 can come out in any order.
The underlying implementation reason why it acts differently
is that sort-with-limit uses a different sorting method.
regards, tom lane