Re: Converting from MySQL - Mailing list pgsql-sql

From Andrew Gierth
Subject Re: Converting from MySQL
Date
Msg-id 87k1iv3n3k.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: Converting from MySQL  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-sql
 >> Failed to find PostgreSQL equivalent for below one because I did not
 >> understand what it does in the first place.
 >> 
 >> SELECT
 >> CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
 >> FROM users WHERE email='%s'

It looks to me like this would work as well or better in PG:

select regexp_replace(email, '^(.*)@(.*)$', '\2/\1/') from ...

-- 
Andrew (irc:RhodiumToad)


pgsql-sql by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Converting from MySQL
Next
From: "Rossi, Maria"
Date:
Subject: Back-out V10 upgrade but keep new data