I would like to convert integer ids in my database into something that is easier to remember.
Mapping function Int -> String should always return a unique 6 letter string for values in range, say, 1-10 000 000, with the same output for the same input.
Example:
select old_id, gen_new_id(old_id)
from unnest(array[1, 2, 800, 289543, 1]) as foo(old_id)
could return
1, powaaa
2, iropwe
800, mnvfeq
289543, opasqa
1, powaaa
I could generate random string, check for uniqueness across the table and store as column in table, but it seems like someone before had to come up with better algorithmic approach.