Compare arrays for equality, ignoring order of elements

后端 未结 5 2072
既然无缘
既然无缘 2020-11-29 11:14

I have a table with 4 array columns.. the results are like:

ids       signed_ids   new_ids   new_ids_signed
{1,2,3} | {2,1,3}    | {4,5,6} | {6,5,4}
<         


        
5条回答
  •  孤城傲影
    2020-11-29 11:42

    If your arrays have no duplicates and are of the same dimension:

    • use array contains @>
    • AND array_length where the length must match the size you want on both sides

提交回复
热议问题