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:
@ -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
|
||||
|
Reference in New Issue
Block a user