Re: Postgres Array Traversing

From: "Milen A(dot) Radev" <milen(at)radev(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Cc: yogesh(dot)arora(at)daffodildb(dot)com
Subject: Re: Postgres Array Traversing
Date: 2007-10-03 15:28:36
Message-ID: 4703B524.50108@radev.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Yogesh Arora написа:
> Hallo All Frnds,
>
> I have to add an array in my table. and to update the array in a
> Procedure called by the trigger.
>
> In my case Like the Elements of the array are {1,2,5} now i have to
> update it to {1,2,5,7} . I.e., Keeping the previous record as such and
> appending the new elements.
[...]

According to the manual
(http://www.postgresql.org/docs/current/static/arrays.html#AEN5830) this
should work:

UPDATE example_table SET an_array_column = an_array_column || 7 WHERE
a_key_column = <value>;

P.S. This questions is probably more appropriate for the "pgsql-sql" list.

--
Milen A. Radev

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Michael Goldner 2007-10-03 15:52:36 Testing lo_unlink() in psql
Previous Message Kevin Kempter 2007-10-03 15:01:25 Re: Database Migration