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