Remove array values in pgSQL

后端 未结 10 2228
不知归路
不知归路 2021-02-06 22:10

Is there a way to remove a value from an array in pgSQL? Or to be more precise, to pop the last value? Judging by this list the answer seems to be no. I can get the result I wan

10条回答
  •  余生分开走
    2021-02-06 22:41

    The simplest way to remove last value:

    array1 = array[1,2,3]
    array1 = ( select array1[1:array_upper(array1, 1) - 1] )
    

提交回复
热议问题