add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
elem pos f_array_move_element_simple
1 1 {1,2,3,4}
1 2 {2,1,3,4}
1 3 {2,3,1,4}
1 4 {2,3,4,1}
2 1 {2,1,3,4}
2 2 {1,2,3,4}
2 3 {1,3,2,4}
2 4 {1,3,4,2}
3 1 {3,1,2,4}
3 2 {1,3,2,4}
3 3 {1,2,3,4}
3 4 {1,2,4,3}
4 1 {4,1,2,3}
4 2 {1,4,2,3}
4 3 {1,2,4,3}
4 4 {1,2,3,4}
elem pos f_array_move_element
1 1 {1,2,3,4}
1 2 {2,1,3,4}
1 3 {2,3,1,4}
1 4 {2,3,4,1}
2 1 {2,1,3,4}
2 2 {1,2,3,4}
2 3 {1,3,2,4}
2 4 {1,3,4,2}
3 1 {3,1,2,4}
3 2 {1,3,2,4}
3 3 {1,2,3,4}
3 4 {1,2,4,3}
4 1 {4,1,2,3}
4 2 {1,4,2,3}
4 3 {1,2,4,3}
4 4 {1,2,3,4}
f_array_move_element_simple
{1,2,666,3,4}
ERROR:  Element 666 not contained in array {1,2,3,4}!
CONTEXT:  PL/pgSQL function f_array_move_element(anyarray,anyelement,integer) line 15 at RAISE

f_array_move_element_simple
{2,1,3,4}
ERROR:  Target position 0 not allowed. Must be a positive integer.
CONTEXT:  PL/pgSQL function f_array_move_element(anyarray,anyelement,integer) line 4 at RAISE

f_array_move_element_simple
{2}
ERROR:  Target position <NULL> not allowed. Must be a positive integer.
CONTEXT:  PL/pgSQL function f_array_move_element(anyarray,anyelement,integer) line 4 at RAISE

f_array_move_element_simple
{1,3,4,2}
ERROR:  Target position 7 not allowed. Cannot be greater than length of array.
CONTEXT:  PL/pgSQL function f_array_move_element(anyarray,anyelement,integer) line 6 at RAISE