Search Postgresql Archives

Re: How to remove an item from integer array type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 20, 2013, at 17:51, ChoonSoo Park <luispark@xxxxxxxxx> 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 split the array around the value to remove, and merge those arrays again.
Something like this:

=> select (ARRAY[100, 101, 102, 103, 104])[1:2] || (ARRAY[100, 101, 102, 103, 104])[4:5];
 ?column?
 -------------------
 {100,101,103,104}
 (1 row) 
 

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux