Skip site navigation (1) Skip section navigation (2)

Re: Postgres Array Traversing

From: yogesh(dot)arora(dot)daffodil(at)gmail(dot)com
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Postgres Array Traversing
Date: 2007-10-04 06:57:05
Message-ID: 1191481025.361203.55090@w3g2000hsg.googlegroups.com (view raw or flat)
Thread:
Lists: pgsql-admin
On Oct 3, 8:28 pm, mi(dot)(dot)(dot)(at)radev(dot)net ("Milen A. Radev") wrote:
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
>                http://www.postgresql.org/about/donate

Thanks Milen A. Radev   It Works..


In response to

pgsql-admin by date

Next:From: Yogesh AroraDate: 2007-10-04 07:38:37
Subject: Problem in Accessing Array Element at Position
Previous:From: Greg WilliamsonDate: 2007-10-04 03:26:12
Subject: Re: RAISE NOTICE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group