> Use a regular expression, e.g.:
> select trim(regexp_replace('foobarbaz', '(.)', E'\\1 ', 'g'));
And if we only match characters until the last character in the
string, we can get rid of the outer trim():
# select regexp_replace('foobarbaz', E'(.)(?!$)', E'\\1 ', 'g'); regexp_replace
-------------------f o o b a r b a z
(1 row)
--
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org