Can I reset the lower bound of an array. - Mailing list pgsql-general

From Mark Gibson
Subject Can I reset the lower bound of an array.
Date
Msg-id 40854040.40106@cromwell.co.uk
Whole thread Raw
Responses Re: Can I reset the lower bound of an array.
List pgsql-general
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.


pgsql-general by date:

Previous
From: "Alan Treece"
Date:
Subject: Re: plpgsql: cannot connect to SPI manager
Next
From: "scott.marlowe"
Date:
Subject: Re: plan-reading extensive tutorial?