Last active
July 8, 2016 19:57
-
-
Save tkreis/cb5a5c471a405772771fadfae06ba216 to your computer and use it in GitHub Desktop.
Transform base64 encoded id as uuid
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
CREATE OR REPLACE FUNCTION decode_uuid(encoded_uuid text) RETURNS uuid AS $$ | |
BEGIN | |
RETURN uuid(encode(decode((encoded_uuid || '==') ,'base64'), 'hex')); | |
END; | |
$$ LANGUAGE plpgsql; | |
-- usage | |
SELECT * from ditto_entity where id = decode_uuid('mttF0tAFSbq1of1oFNfAJw'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment