Skip to content

Instantly share code, notes, and snippets.

@JuneKelly
Created July 3, 2016 17:15
Show Gist options
  • Save JuneKelly/a71893eca63b60837f8f88edf27f7f7e to your computer and use it in GitHub Desktop.
Save JuneKelly/a71893eca63b60837f8f88edf27f7f7e to your computer and use it in GitHub Desktop.
Postgres: sixteen-char random urlsafe base64 value
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