Thread: Adding on to the end of an array

Adding on to the end of an array

From
Matthew C Forman
Date:
Hi all,

I'm very new to PostgreSQL, but this doesn't seem to be in the FAQs, and
I can't find anything 'out there'...

I moved to pgsql because of its array support. I need to be able to append
an element on to an existing array _without knowing its current length_.
I thought that I may be able to find out the length of an array and then
construct a subscript for the next (currently non-existent) element by
just adding 1, but... array_dims() doesn't seem to give easily useable
output.

Does anyone have any idea on this?

Thanks in advance,
Matthew

--
Dr. Matthew C. Forman                   mcf@dmu.ac.uk
School of Engineering & Technology
De Montfort University, Leicester, UK.


Re: Adding on to the end of an array

From
"Ryan Mahoney"
Date:
Get the current postgres beta and read the new intarray docs, the
functionality you need is there!

-r

----- Original Message -----
From: "Matthew C Forman" <mcf@dmu.ac.uk>
To: <pgsql-general@postgresql.org>
Sent: Monday, October 14, 2002 3:46 PM
Subject: [GENERAL] Adding on to the end of an array


>
> Hi all,
>
> I'm very new to PostgreSQL, but this doesn't seem to be in the FAQs, and
> I can't find anything 'out there'...
>
> I moved to pgsql because of its array support. I need to be able to append
> an element on to an existing array _without knowing its current length_.
> I thought that I may be able to find out the length of an array and then
> construct a subscript for the next (currently non-existent) element by
> just adding 1, but... array_dims() doesn't seem to give easily useable
> output.
>
> Does anyone have any idea on this?
>
> Thanks in advance,
> Matthew
>
> --
> Dr. Matthew C. Forman                   mcf@dmu.ac.uk
> School of Engineering & Technology
> De Montfort University, Leicester, UK.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>