Re: How to remove an item from integer array type

From: Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)uk>
To: ChoonSoo Park <luispark(at)gmail(dot)com>
Cc: 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 16:58:09
Message-ID: 8D0E5D045E36124A8F1DDDB463D548557D1618F3A4@mxsvr1.is.inps.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>Sorry,
>
>It's not ordered by value. It's not sorted list unfortunately. It can be '{100, 120, 102, 130, 104}'.
>
>Do you have other suggestion?
>
>Thank you,
>Choon Park

This should work:
update a set f2 = (select array_agg(X.id) from (select f1, unnest(f2) id from a where f1 = 1 except select 1 f1, 101 id) X) where f1 = 1;

Regards,

Russell Keane
INPS

Tel: +44 (0)20 7501 7277
[cid:image001(dot)jpg(at)01CE0F8B(dot)75C5EF60]
Follow us<https://twitter.com/INPSnews> on twitter | visit www.inps.co.uk<http://www.inps.co.uk/>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Russell Keane 2013-02-20 17:06:57 Re: How to remove an item from integer array type
Previous Message ChoonSoo Park 2013-02-20 16:51:55 Re: How to remove an item from integer array type