Search Postgresql Archives

Questions about setting an array element value outside of the update

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

 



Lets say i have subquery which produce array[], position and new_value

Is here less clumsy way to set  array[position] to the new_value (not update but just change an element inside an array) than:

SELECT
        _array[1:pos-1]
        ||newval
        ||_array[_pos+1:array_length(_array, 1)]
FROM
(
    SELECT _array,
                   pos,
                   newval
     FROM
                   some_colmplicated_logic
);

The:
        _array[1:pos-1]
        ||newval
        ||_array[_pos+1:array_length(_array, 1)]
part is very clumsy for my eyes.

PS: that is just small part of the complicated WITH RECURSIVE iterator in real task.

--
Maxim Boguk
Senior Postgresql DBA.


[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