Search Postgresql Archives

Can I reset the lower bound of an array.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I've been playing about with array's, and found the concat operator '||' quite
useful, apart from the fact that prepending an element places it in a lower subscript.


Is there a way of either:
a) prepending an element, but shifting existing elements up a subscript,
so that the lower bound remains the same?
eg: 1 ||> ARRAY[2,3,4] -- new operator ||> shift array and prepend
or
b) resetting the lower bound of the array (without affecting elements)?
eg: set_array_lower(1 || ARRAY[2,3,4], 1) -- 2nd arg is the new lower bound


Also, while on the topic of array's:

Is there any way to specify array slices from a subscript to the beginning or end of an array?
eg:
element to end: array[5:*]
beginning to element: array[*:5]


At present it is possible by using an extreme +ve or -ve subscript value, but this isn't nice.

Cheers

--
Mark Gibson <gibsonm |AT| cromwell |DOT| co |DOT| uk>
Web Developer & Database Admin
Cromwell Tools Ltd.
Leicester, England.


---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux