Update int array based on parent
Posted
by
Pickels
on Stack Overflow
See other posts from Stack Overflow
or by Pickels
Published on 2012-10-22T16:44:58Z
Indexed on
2012/10/22
17:01 UTC
Read the original article
Hit count: 186
postgresql
I have the following int[] in my database:
'{0}'
'{0,0}'
'{0,0,0}'
'{0,0,0,0}'
This column is used to sort my tree data. Now when a parent updates it's order the children should also update. For example if the second record updates it's order to 1 it should result in the following.
'{0}'
'{0,1}'
'{0,1,0}'
'{0,1,0,0}'
So I was wondering what the query would be to update record 3 and 4. In case it's not clear what I am asking leave a comment I can add additional information.
Screenshot of my actual data:
© Stack Overflow or respective owner