Re: How to remove an item from integer array type

From: Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)uk>
To: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
Cc: ChoonSoo Park <luispark(at)gmail(dot)com>, PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to remove an item from integer array type
Date: 2013-02-20 17:47:01
Message-ID: 8D0E5D045E36124A8F1DDDB463D548557D1618F3B1@mxsvr1.is.inps.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>Moving the exclusion operation up a level seems to do the trick:
>
>testdb=# BEGIN ;
>BEGIN
>testdb=*# update tableA set f2 = (select array_agg(X.id) from (select f1, unnest(f2) id from tablea where f1 = 1) x WHERE x.id != 101) where f1=1; UPDATE 1 testdb=*# SELECT * from tablea ;
> f1 | f2
>----+-------------------------
> 1 | {100,102,103,99,104,22}
> (1 row)
>
> (It's a bit late where I am so I might be overlooking something)
>
>
>Ian Barwick

You're absolutely correct Ian.
(It's getting late here too ;) )

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2013-02-20 19:24:18 Re: How to remove an item from integer array type
Previous Message Christian Schröder 2013-02-20 17:31:41 Re: Perl function leading to out of memory error