'separate number digits postgresql

i'm trying to find an sql function that can split a number into separate digits. ex. num=78912346 split_num(num)={7,8,9,1,2,3,4,6}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source