Re: [HACKERS] CSV hack

2003-12-11 Thread David Fetter
In article <[EMAIL PROTECTED]> you wrote: > > You also need to quote values containing the separator. Roight! Thanks for the heads-up :) And now, version 2. Cheers, D CREATE OR REPLACE FUNCTION csv(anyarray) RETURNS TEXT AS 'DECLARE in_array ALIAS FOR $1; temp_string TEXT; quoted_

Re: [HACKERS] CSV hack

2003-12-10 Thread Andrew Dunstan
You also need to quote values containing the separator. cheers andrew (who used to set creating CSV as a programming exercise - students almost never get it right) David Fetter wrote: Kind people, I've come up with yet another little hack, this time for turning 1-d arrays into CSV format. It

Re: [Dbdpg-general] Re: [HACKERS] CSV hack

2003-12-10 Thread David Fetter
On Wed, Dec 10, 2003 at 05:08:19PM -0800, Joe Conway wrote: > David Fetter wrote: > >I've come up with yet another little hack, this time for turning 1-d > >arrays into CSV format. > > You mean like this (which is new in 7.4)? > > regression=# select array_to_string (array[1,2,3], ','); > array

Re: [HACKERS] CSV hack

2003-12-10 Thread Joe Conway
David Fetter wrote: I've come up with yet another little hack, this time for turning 1-d arrays into CSV format. You mean like this (which is new in 7.4)? regression=# select array_to_string (array[1,2,3], ','); array_to_string - 1,2,3 (1 row) See: http://www.postgresql.org/docs

[HACKERS] CSV hack

2003-12-10 Thread David Fetter
Kind people, I've come up with yet another little hack, this time for turning 1-d arrays into CSV format. It's very handy in conjunction with the array_accum aggregate (can this be made a standard aggregate?) in . Here 'tis... CREATE OR