postgresql/src/backend
Tom Lane 569ed7f483 Redesign the API for list sorting (list_qsort becomes list_sort).
In the wake of commit 1cff1b95a, the obvious way to sort a List
is to apply qsort() directly to the array of ListCells.  list_qsort
was building an intermediate array of pointers-to-ListCells, which
we no longer need, but getting rid of it forces an API change:
the comparator functions need to do one less level of indirection.

Since we're having to touch the callers anyway, let's do two additional
changes: sort the given list in-place rather than making a copy (as
none of the existing callers have any use for the copying behavior),
and rename list_qsort to list_sort.  It was argued that the old name
exposes more about the implementation than it should, which I find
pretty questionable, but a better reason to rename it is to be sure
we get the attention of any external callers about the need to fix
their comparator functions.

While we're at it, change four existing callers of qsort() to use
list_sort instead; previously, they all had local reinventions
of list_qsort, ie build-an-array-from-a-List-and-qsort-it.
(There are some other places where changing to list_sort perhaps
would be worthwhile, but they're less obviously wins.)

Discussion: https://postgr.es/m/29361.1563220190@sss.pgh.pa.us
2019-07-16 11:51:44 -04:00
..
access Fix inconsistencies and typos in the tree 2019-07-16 13:23:53 +09:00
bootstrap Fix inconsistencies and typos in the tree 2019-07-16 13:23:53 +09:00
catalog Fix inconsistencies and typos in the tree 2019-07-16 13:23:53 +09:00
commands Remove dead code. 2019-07-15 23:27:13 -04:00
executor Fix inconsistencies and typos in the tree 2019-07-16 13:23:53 +09:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Fix more typos and inconsistencies in the tree 2019-06-17 16:13:16 +09:00
lib Fix inconsistencies in the code 2019-07-08 13:15:09 +09:00
libpq Represent Lists as expansible arrays, not chains of cons-cells. 2019-07-15 13:41:58 -04:00
main Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
nodes Redesign the API for list sorting (list_qsort becomes list_sort). 2019-07-16 11:51:44 -04:00
optimizer Redesign the API for list sorting (list_qsort becomes list_sort). 2019-07-16 11:51:44 -04:00
parser Redesign the API for list sorting (list_qsort becomes list_sort). 2019-07-16 11:51:44 -04:00
partitioning Represent Lists as expansible arrays, not chains of cons-cells. 2019-07-15 13:41:58 -04:00
po Translation updates 2019-06-17 15:30:20 +02:00
port Update stale comments, and fix comment typos. 2019-06-08 10:12:26 -07:00
postmaster Fix inconsistencies in the code 2019-07-08 13:15:09 +09:00
regex Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
replication Redesign the API for list sorting (list_qsort becomes list_sort). 2019-07-16 11:51:44 -04:00
rewrite Redesign the API for list sorting (list_qsort becomes list_sort). 2019-07-16 11:51:44 -04:00
snowball Sync our Snowball stemmer dictionaries with current upstream 2019-07-04 13:26:48 +02:00
statistics Remove unused variable in statext_mcv_serialize() 2019-07-05 18:51:56 +02:00
storage Fix inconsistencies and typos in the tree 2019-07-16 13:23:53 +09:00
tcop Represent Lists as expansible arrays, not chains of cons-cells. 2019-07-15 13:41:58 -04:00
tsearch Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
utils Fix inconsistencies and typos in the tree 2019-07-16 13:23:53 +09:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
nls.mk Translation updates 2019-05-20 16:00:53 +02:00