Sequence according to value from table in postgresql
If I understand correctly you want to have ids that depend on another column. I'm sorry not to answer your question, because I don't understand that need. Why would you need that ?

The only purpose of a sequence is giving unique values. What's wrong with that kind of data?

id       type_id     value
-------  -------  -------
1        1         value1
2        2         value2
3        1         value3
4        1         value4
5        2         value5


If your problem is that you want to be able to sort your data by type_id and then by id, just try that query :

select id,
  type_id,
  value
from my_table
order by type_id, id