diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-11-13 13:49:48 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-11-13 13:49:48 -0500 |
commit | ec0294fb2c8287fd673c57701cdcf6c6396b2f60 (patch) | |
tree | fa0351c7913ee59a410776561e7328aeb6805299 /src/backend/access/gist/gistproc.c | |
parent | 3bf44303b954269558c30458df8d02fb99c40c67 (diff) | |
download | postgresql-ec0294fb2c8287fd673c57701cdcf6c6396b2f60.tar.gz postgresql-ec0294fb2c8287fd673c57701cdcf6c6396b2f60.zip |
Support negative indexes in split_part().
This provides a handy way to get, say, the last field of the string.
Use of a negative index in this way has precedent in the nearby
left() and right() functions.
The implementation scans the string twice when N < -1, but it seems
likely that N = -1 will be the huge majority of actual use cases,
so I'm not really excited about adding complexity to avoid that.
Nikhil Benesch, reviewed by Jacob Champion; cosmetic tweakage by me
Discussion: https://postgr.es/m/cbb7f861-6162-3a51-9823-97bc3aa0b638@gmail.com
Diffstat (limited to 'src/backend/access/gist/gistproc.c')
0 files changed, 0 insertions, 0 deletions