Rewriting CONCAT_WS to Postgres11/18/2010
I have noticed a couple complaints about converting MySQL's CONCAT and CONCAT_WS functions to Postgres .
Naturally, such a commonly used function must work, so I rewrote it with the parser:
select concat_ws(',', `asdf`, 'w00t', somecolumn) from mysql.db;
Is rewritten to:
select ARRAY_TO_STRING(ARRAY["asdf", 'w00t', somecolumn], ',') from mysql.db;
It seems the Postgres way is uglier but it is far more versatile than CONCAT_WS. Not only does Postgres have array types, but it can handle many more cases than just concatenating elements.
Even more awesome is coming soon.