agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: How would I get rid of trailing blank line?
Date: 10 Apr 2009 15:09:42 GMT
Message-ID: <grnnfm$51i$1@reversiblemaps.ath.cx> (raw)
References: <FE44E0D7EAD2ED4BB2165071DB8E328C04E84A65@egcrc-ex01.egcrc.org>
On 2009-04-02, Tena Sakai <tsakai@gallo.ucsf.edu> wrote:
> I am using postgres 8.3.4 on linux.
> I often use a line like:
> psql -tf query.sql mydatabase > query.out
>
> -t option gets rid of the heading and count
> report at the bottom. There is a blank line
> at the bottom, however. Is there any way to
> have psql not give me that blank line?
I ask postgres to format it for me instead of relying on psql
psql db_name -c "copy (select * from foo ) to stdout;"
this gives me postgres style tab separated values, but I can
have CSV (or any otther format COPY can do) if I want.
I usually use a more complex subquery with a list of columns and
expressions, where, order by clauses, etc... )
I use this in a script that pulls data from one database and inserts
in into another.
Requires postgres 8.2 or later
view thread (9+ messages) latest in thread
Message-ID: <grnnfm$51i$1@reversiblemaps.ath.cx>
Permalink: ../grnnfm$51i$1@reversiblemaps.ath.cx/
Also on: postgresql.org/message-id/grnnfm$51i$1@reversiblemaps.ath.cx
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasen@xnet.co.nz
Subject: Re: How would I get rid of trailing blank line?
In-Reply-To: <grnnfm$51i$1@reversiblemaps.ath.cx>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox