Skip site navigation (1) Skip section navigation (2)

Re: Comma delimited results

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Chad Thompson" <chad(at)weblinkservices(dot)com>
Cc: "pgsql-novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Comma delimited results
Date: 2002-12-23 19:49:02
Message-ID: 7335.1040672942@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
"Chad Thompson" <chad(at)weblinkservices(dot)com> writes:
> Is there a way to display all the results of a row as one big comma delimit=
> ed string?

In psql, you can do:

regression=# select * from tenk1 limit 2;
 unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
    8800 |       0 |   0 |    0 |   0 |      0 |       0 |      800 |         800 |      3800 |     8800 |   0 |    1 | MAAAAA   | AAAAAA   | AAAAxx
    1891 |       1 |   1 |    3 |   1 |     11 |      91 |      891 |        1891 |      1891 |     1891 | 182 |  183 | TUAAAA   | BAAAAA   | HHHHxx
(2 rows)

regression=# \a
Output format is unaligned.
regression=# \f ,
Field separator is ','.
regression=# \t
Showing only tuples.
regression=# select * from tenk1 limit 2;
8800,0,0,0,0,0,0,800,800,3800,8800,0,1,MAAAAA,AAAAAA,AAAAxx
1891,1,1,3,1,11,91,891,1891,1891,1891,182,183,TUAAAA,BAAAAA,HHHHxx
regression=#

Dunno if that's quite what you wanted ... but a little digging in the
psql reference page seems warranted ...

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Reshat SabiqDate: 2002-12-23 21:59:14
Subject: money type
Previous:From: Tom LaneDate: 2002-12-23 19:26:36
Subject: Re: performance question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group