Re: How would I get rid of trailing blank line? - Mailing list pgsql-sql

From Jasen Betts
Subject Re: How would I get rid of trailing blank line?
Date
Msg-id grnnfm$51i$1@reversiblemaps.ath.cx
Whole thread Raw
In response to How would I get rid of trailing blank line?  ("Tena Sakai" <tsakai@gallo.ucsf.edu>)
List pgsql-sql
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




pgsql-sql by date:

Previous
From: Jasen Betts
Date:
Subject: Re: changing multiple pk's in one update
Next
From: Scott Marlowe
Date:
Subject: Re: changing multiple pk's in one update