Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread Alban Hertroys
On Feb 20, 2013, at 17:51, ChoonSoo Park wrote: > Sorry, > > It's not ordered by value. It's not sorted list unfortunately. It can be > '{100, 120, 102, 130, 104}'. Are you saying it's an unordered list for which the order matters? That seems a bit peculiar. What would probably work is to sp

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread Russell Keane
>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 |

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread Ian Lawrence Barwick
2013/2/21 Russell Keane > > > > >>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 = (

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread ChoonSoo Park
It works! Thank you, Choon Park On Wed, Feb 20, 2013 at 12:06 PM, Russell Keane wrote: > ** ** > > >>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? > > >>

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread Russell Keane
>>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 =

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread Russell Keane
>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 sele

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread ChoonSoo Park
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 On Wed, Feb 20, 2013 at 11:47 AM, Ian Lawrence Barwick wrote: > 2013/2/21 ChoonSoo Park > > > > Hello Gurus, > > > > Table A has int

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread Ian Lawrence Barwick
2013/2/21 ChoonSoo Park > > Hello Gurus, > > Table A has integer[] column. I need to delete specific integer value from > that column. > > f1 | f2 > 1 {100, 101, 102, 103} > 2 {200, 300, 400} > > I want to remove 101 from f2 and also preserve the order. > > f1 |

[GENERAL] How to remove an item from integer array type

2013-02-20 Thread ChoonSoo Park
Hello Gurus, Table A has integer[] column. I need to delete specific integer value from that column. f1 | f2 1 {100, 101, 102, 103} 2 {200, 300, 400} I want to remove 101 from f2 and also preserve the order. f1 | f2 1 {100, 102, 103} 2 {20