Find this example https://stackoverflow.com/a/13629639/947111 but it's for sqlserver while I need it for Postgresql.
For example my table has the following structure:
id|title|slot_id
----------------
1 |    1|     1
2 |    2|     1
3 |    3|     1
4 |    1|     2
5 |    2|     2
When I delete row from the middle of set (set defined by slot_id), for example 1,2,3 where slot_id = 1 and row with title = 2 was removed I need to perform renaming so it won't 1,3 but 1,2
 
     
    