Created
February 25, 2018 16:32
-
-
Save vithalsamp/4bcd03e7fda4643e7bd0baf45d94380c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 udf_domain (email varchar(max)) | |
returns varchar(max) | |
stable as $$ | |
if not email: | |
return None | |
return email.split('@')[-1] | |
$$ language plpythonu; | |
--Call User defined function | |
training=# Select udf_domain ('[email protected]'); | |
udf_domain | |
------------ | |
dwgeek.com | |
(1 row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment