Can I reset the lower bound of an array.

From: Mark Gibson <gibsonm(at)cromwell(dot)co(dot)uk>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Can I reset the lower bound of an array.
Date: 2004-04-20 15:22:40
Message-ID: 40854040.40106@cromwell.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2004-04-20 15:37:39 Re: [OT] Tom's/Marc's spam filters?
Previous Message Alan Treece 2004-04-20 14:56:01 Re: plpgsql: cannot connect to SPI manager