Skip to content

Instantly share code, notes, and snippets.

View edwardsharp's full-sized avatar
i'm a teapot

edward sharp edwardsharp

i'm a teapot
View GitHub Profile
edwardsharp / base36_encode_decode.sql
Created December 14, 2017 19:27 — forked from btbytes/base36_encode_decode.sql
Base36 Conversion in PostgreSQL
-- source:
CREATE OR REPLACE FUNCTION base36_encode(IN digits bigint, IN min_width int = 0)
RETURNS varchar AS $$
chars char[];
ret varchar;
val bigint;
chars := ARRAY['0','1','2','3','4','5','6','7','8','9'