Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 22DF06338B3 for ; Fri, 10 Apr 2009 12:09:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55590-07 for ; Fri, 10 Apr 2009 12:09:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from oberon.wxnz.net (oberon.wxnz.net [58.28.6.13]) by mail.postgresql.org (Postfix) with ESMTP id 4DA27633314 for ; Fri, 10 Apr 2009 12:09:46 -0300 (ADT) Received: from gonzo (ip-118-90-138-193.xdsl.xnet.co.nz [118.90.138.193]) by oberon.wxnz.net (Postfix) with ESMTP id E798C46C003 for ; Sat, 11 Apr 2009 03:09:43 +1200 (NZST) Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1LsIMQ-0001LQ-Lp for pgsql-sql@postgresql.org; Sat, 11 Apr 2009 03:09:42 +1200 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: How would I get rid of trailing blank line? Date: 10 Apr 2009 15:09:42 GMT Organization: Dis (not Dat) Organisation Lines: 26 Message-ID: References: NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reversiblemaps.ath.cx 1239376182 5170 127.0.0.1 (10 Apr 2009 15:09:42 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200904/51 X-Sequence-Number: 32397 On 2009-04-02, Tena Sakai 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