I have dictionary_type and dictionary_value tables. Value is connected with type. I would like to create sequence which will set the id of values according to type id.
Expected dictionary_type:
id type
---- ----
1 type1
2 type2
Expected dictionary_value:
id type_id value
------- ------- -------
100 1 value1
200 2 value2
101 1 value3
102 1 value4
201 2 value5
So baiscly I would like to make it like: nextval(sequence(type_id * 100)). How can I do it in postgresql?
Have a nice day!