Split text in postgres
You can split text in postgres
select email from users;
bob@example.com
mary@example.com
select split_part(email, '@', 1) from users;
bob
mary
select split_part(email, '@', 2) from users;
@example.com
@example.com
Which can be helpful when sanitizing data:
update users
set email = split_part(email, '@', 1) || '@example.com';
Tweet