Re: Controlling psql output

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Controlling psql output
Date: 2009-05-11 09:02:30
Message-ID: gu8pj6$via$2@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2009-05-08, Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com> wrote:
> --_000_482E80323A35A54498B8B70FF2B87980040106E94Bazsmsx504amrc_
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> Hi:
>
> Using a single psql command to generate stdout in linux that will be redire=
> cted to a file. Many rows with 1 column are returned. I want no header, n=
> o footer, no blank lines at the top or bottom, no initial space before each=
> record. This is what I'm trying...
>
> psql -P tuples_only=3Don,footer=3Doff,border=3D0 mydb
>
> This gets rid of the header and footer OK. But there is still a blank line=
> as the first line in stdout. Also, each record has a preceding space befo=
> re the column value.
>
> Is there a way to do what I want?

use "copy (select ...) to stdout" instead of "select ..."

requires 8.3 or greater.
as a bonus nulls and control characters re represented unambiguously.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Emanuel Calvo Franco 2009-05-11 12:19:37 Re: limit-offset different result sets with same query
Previous Message Henry 2009-05-11 08:22:40 Re: FW: how many connections can i use????