pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Milen A. Radev <milen@radev.net>
To: pgsql-admin@postgresql.org
Cc: yogesh.arora@daffodildb.com
Subject: Re: Postgres Array Traversing
Date: Wed, 03 Oct 2007 18:28:36 +0300
Message-ID: <4703B524.50108@radev.net> (raw)
In-Reply-To: <116685ec0710030327v7e35b5d3s7a9202e98be4ad2@mail.gmail.com>
References: <116685ec0710030327v7e35b5d3s7a9202e98be4ad2@mail.gmail.com>

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




view thread (3+ messages)  latest in thread

Message-ID: <4703B524.50108@radev.net>
Permalink:  ../4703B524.50108@radev.net/
Also on:    postgresql.org/message-id/4703B524.50108@radev.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: milen@radev.net, yogesh.arora@daffodildb.com
  Subject: Re: Postgres Array Traversing
  In-Reply-To: <4703B524.50108@radev.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox