How to swap array values in PostgreSQL.? How to swap array values in PostgreSQL. For example i have a table that has a column whose data type is bigint[]. It has following value in it.

value: {111, 222, 333}
My desired output is {333, 111, 222}

i can not find any built in function to achieve other than array_replace.
You can access the values by index, as follows: 

postgres=# create table intarray ( aaa int8[] ) ;
CREATE TABLE
postgres=# insert into intarray values ( ARRAY [ 111, 222, 333 ]  ) ;
INSERT 0 1
postgres=# select * from intarray;
      aaa      
---------------
 {111,222,333}
(1 row)

postgres=# select aaa[3],aaa[2],aaa[1] from intarray;
 aaa | aaa | aaa 
-----+-----+-----
 333 | 222 | 111
(1 row)

postgres=# select ARRAY[aaa[3],aaa[1],aaa[2]] from intarray;
     array     
---------------
 {333,111,222}
(1 row)

postgres=# 


Reading the documentation may help you.