Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 6FD519FB2DA for ; Tue, 13 Mar 2007 19:27:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 40737-03 for ; Tue, 13 Mar 2007 19:27:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 1158E9FA38A for ; Tue, 13 Mar 2007 19:27:49 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-201-67.bk11-dsl.surnet.cl [201.221.201.67]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l2DMResh006089; Tue, 13 Mar 2007 15:27:41 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id DF3D832A15; Tue, 13 Mar 2007 18:27:33 -0400 (CLT) Date: Tue, 13 Mar 2007 18:27:33 -0400 From: Alvaro Herrera To: T E Schmitz Cc: pgsql-sql@postgresql.org Subject: Re: import CSV file Message-ID: <20070313222733.GE3285@alvh.no-ip.org> Mail-Followup-To: T E Schmitz , pgsql-sql@postgresql.org References: <45F70BC9.801@numerixtechnology.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45F70BC9.801@numerixtechnology.de> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Tue, 13 Mar 2007 15:27:41 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/184 X-Sequence-Number: 27822 T E Schmitz wrote: > I am trying to batch-load a tab-separated CSV file: > > psql -h lolek -U tes -d stockmarket -c "copy history from > '/tmp/FTSE.csv' CSV"; > > ERROR: could not open file "/tmp/FTSE.csv" for reading: No such file or > directory > > The file exists. Do I need to escape the quotes? Is the server on the same machine that's running psql? If not, then this fails because it tries to open the file server-side. The suggested workaround is to use psql's \copy. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support