Skip to content

Instantly share code, notes, and snippets.

@tygern
Created August 26, 2015 13:17
Show Gist options
  • Select an option

  • Save tygern/3c3f68818a5aa73ed602 to your computer and use it in GitHub Desktop.

Select an option

Save tygern/3c3f68818a5aa73ed602 to your computer and use it in GitHub Desktop.
Non Sequential ID Generation - create function
CREATE FUNCTION fetch_id(text) RETURNS bigint AS
'select (9369712273 * nextval($1) + 1365089121) % 999999937;'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment