View Single Post
  #2 (permalink)  
Old 05-05-2006, 01:56 AM
ben ben is offline
Administrator
 
Join Date: Mar 2007
Posts: 87
ben has disabled reputation
Default Postgresql answer. Re: Return a comma seperated string?

Answer received on the Postgresql IRC channel by scampbell and indigo.

[sql]
SELECT array_to_string(array(SELECT REPLACE(column, ',', '\,') FROM sometable), ',')
[/sql]

now you have a rll encoded output, , are imbedded data commas and , are field separators. No data corruption on the transfer just turn the , back into , on the receiving side.

---
As indigo noticed the character would also have to be escaped.
Reply With Quote