1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Allow to omit boundaries in array subscript

Allow to omiy lower or upper or both boundaries in array subscript
for selecting slice of array.

Author: YUriy Zhuravlev
This commit is contained in:
Teodor Sigaev
2015-12-18 15:18:58 +03:00
parent 33bd250f6c
commit 9246af6799
12 changed files with 184 additions and 28 deletions

View File

@ -255,6 +255,26 @@ SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill';
------------------------
{{meeting},{training}}
(1 row)
</programlisting>
Possible to skip the <literal><replaceable>lower-bound</replaceable></literal> or
<literal><replaceable>upper-bound</replaceable></literal>
for get first or last element in slice.
<programlisting>
SELECT schedule[:][:] FROM sal_emp WHERE name = 'Bill';
schedule
------------------------
{{meeting,lunch},{training,presentation}}
(1 row)
SELECT schedule[:2][2:] FROM sal_emp WHERE name = 'Bill';
schedule
------------------------
{{lunch},{presentation}}
(1 row)
</programlisting>
If any dimension is written as a slice, i.e., contains a colon, then all