Created
July 3, 2016 17:15
-
-
Save JuneKelly/a71893eca63b60837f8f88edf27f7f7e to your computer and use it in GitHub Desktop.
Postgres: sixteen-char random urlsafe base64 value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select replace( | |
replace( | |
cast(encode(gen_random_bytes(12), 'base64') as varchar), | |
'+', '-'), | |
'/', '_' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment