Add SQL function array_reverse()
Michael Paquier <michael@paquier.xyz>
Add SQL function array_reverse() This function takes in input an array, and reverses the position of all its elements. This operation only affects the first dimension of the array, like array_shuffle(). The implementation structure is inspired by array_shuffle(), with a subroutine called array_reverse_n() that may come in handy in the future, should more functions able to reverse portions of arrays be introduced. Bump catalog version. Author: Aleksander Alekseev Reviewed-by: Ashutosh Bapat, Tom Lane, Vladlen Popolitov Discussion: https://postgr.es/m/CAJ7c6TMpeO_ke+QGOaAx9xdJuxa7r=49-anMh3G5476e3CX1CA@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +17 −0 |
| src/backend/utils/adt/array_userfuncs.c | modified | +112 −0 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +3 −0 |
| src/test/regress/expected/arrays.out | modified | +31 −0 |
| src/test/regress/sql/arrays.sql | modified | +7 −0 |
Documentation touched
Discussion
- [PATCH] Add array_reverse() function 9 messages · 2024-10-21 → 2024-11-01