'|| operator is not working properly for array concatenation in postgresql

I'm using || operator to concatenate two arrays in postgresql.

Name
A
B
C
D
E

Array[A,B,C] : where A, B, C are values from a column name whose type is text Array[D,E,F] : where D, E, F are values from a column name whose type is text

Array[A,B,C] || Array[D,E,F] should be ===> Array["A","B","C","D","E","F"] because the name column is of type text but I'm the actual result is Array["A",B,C,D,E,F]

Can anyone tell me why it is behaving like this? Or are there any other approaches which i can try?

I have tried || and array_cat but both of them are basically same and giving me incorrect results.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source