Re: How would I get rid of trailing blank line?

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: How would I get rid of trailing blank line?
Дата
Msg-id grnnfm$51i$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на How would I get rid of trailing blank line?  ("Tena Sakai" <tsakai@gallo.ucsf.edu>)
Список 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 по дате отправления:

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: changing multiple pk's in one update
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: changing multiple pk's in one update