Re: [Dbdpg-general] Re: CSV hack

From: David Fetter <david(at)fetter(dot)org>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>, "DBD::Pg" <dbdpg-general(at)svr3(dot)postgresql(dot)org>
Subject: Re: [Dbdpg-general] Re: CSV hack
Date: 2003-12-11 01:54:59
Message-ID: 20031211015459.GA32379@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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_to_string
> -----------------
> 1,2,3
> (1 row)

Not quite. The CSV thing quotes the way you'd see in CSV files, as in

SELECT csv(array['"1'::text, '2'::text, '3'::text]);
csv
-----------
"""1",2,3

> See:
> http://www.postgresql.org/docs/current/static/functions-array.html

It's great, and I use it :)

> >It's very handy in conjunction with the array_accum aggregate (can
> >this be made a standard aggregate?) in
> ><http://developer.postgresql.org/docs/postgres/xaggr.html>.
>
> Early in the 7.4 dev cycle array_accum() was actually in cvs as a
> built-in C function (and it still does exist in PL/R as such). But
> toward the end of the cycle an objection was raised and it was
> removed. Search the archives in the May/June 2003 timeframe.

Um, OK. It would be kinda handy, tho.

Cheers,
D
--
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100 cell: +1 415 235 3778

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2003-12-11 04:01:46 Re: CSV hack
Previous Message Joe Conway 2003-12-11 01:08:19 Re: CSV hack