What is an efficient function I could use to increase the amount of elements in an array by their position?
For example, if I have an array of:
ARRAY[10,20,30,40,50]::INT[]
I would like that to turn into:
ARRAY[10,20,20,30,30,30,40,40,40,40,50,50,50,50,50]::INT[]
So that I have 1 "10", 2 "20", 3 "30", 4 "40", and 5 "50".
For the array:
ARRAY[10,20,30,40,10]::INT[]
I would like that to turn into:
ARRAY[10,20,20,30,30,30,40,40,40,40,10,10,10,10,10]::INT[]
So that I have 6 "10", 2 "20", 3 "30" and 4 "40".