Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 6140E632D87 for ; Fri, 25 Jun 2010 15:37:35 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 20938-06 for ; Fri, 25 Jun 2010 18:37:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pv0-f174.google.com (mail-pv0-f174.google.com [74.125.83.174]) by mail.postgresql.org (Postfix) with ESMTP id 278DF6327F0 for ; Fri, 25 Jun 2010 15:37:27 -0300 (ADT) Received: by pvg2 with SMTP id 2so986318pvg.19 for ; Fri, 25 Jun 2010 11:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=W9RJ9sXel5+jKgrvkEkn92VDGVZn7i1G2LjzFRuWRWw=; b=ZutYVB5VOziJUOOFQtqghNEigQk5HTQx8jF1Hu7Oaz9ARy38nPaX5e9aUi+wp4V5U0 /Pjh3LNteX2Vx44PMaaL4h+QRgXcLLrmkInDNR7TneuGf372z3MSU8mMxjPmLclv4QND ZcTtXZnYIr8yyeYoY/gmRCpdMDjN4cXycmmjw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=oIffW4ne3W5t4e0Mtki20MzkfTv8JgPW0dn/xZn+Q+7032Rqh/kMt62aNkos3YNd/9 mOBLvB8fHb4ZZDtYyc+sCI//9W7697jhgwMz30NjEzdXMsNSW9KQSmBojNeC5eiZKHrt cDCjiIRygyiCOBu9Uk4cNnEmgS5BE+FnjqLXk= Received: by 10.115.114.21 with SMTP id r21mr1377157wam.132.1277491046486; Fri, 25 Jun 2010 11:37:26 -0700 (PDT) Received: from [192.168.0.102] (c-24-17-179-185.hsd1.wa.comcast.net [24.17.179.185]) by mx.google.com with ESMTPS id d20sm2803742waj.22.2010.06.25.11.37.25 (version=SSLv3 cipher=RC4-MD5); Fri, 25 Jun 2010 11:37:25 -0700 (PDT) Message-ID: <4C24F765.40008@gmail.com> Date: Fri, 25 Jun 2010 11:37:25 -0700 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: "bruno.scovoli" CC: pgsql-sql@postgresql.org Subject: Re: COPY command and required file permissions References: <28976565.post@talk.nabble.com> In-Reply-To: <28976565.post@talk.nabble.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.001 tagged_above=-5 required=5 tests=BAYES_20=-0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201006/92 X-Sequence-Number: 34283 On 06/23/2010 02:01 PM, bruno.scovoli wrote: > > I have an script with many "\copy" commands. For example: > > \copy privilegios from '/work/eclipse-workspace/Canoan > Server/database/load/privilegios.dat' > \copy privilegios_de_usuarios from '/work/eclipse-workspace/Canoan > Server/database/load/privilegios_de_usuarios.dat' > \copy classificacoes from '/work/eclipse-workspace/Canoan > Server/database/load/classificacoes.dat' > \copy tipo_de_produto from '/work/eclipse-workspace/Canoan > Server/database/load/tipos.dat' > > This lines are OK. But when I remove the preceding backslash from them I get > the error that you mentioned. > > > Harold A. Giménez Ch. wrote: >> >> Hi all, >> In migrating an application from sql server to Postgres, I created a ruby >> script that extracts csv files from sql server (from a windows box), then >> SCPs them into a directory (/home/ruby_process) on the server running >> Postgres (a Fedora core 8) and finally runs the Postgres COPY command for >> each of the csv files. >> >> When the script runs the COPY commnand, I get the following error (for the >> genders table): >> >> ERROR C42501 M could not open file "/home/ruby_process/genders.csv" >> for >> reading: Permission denied Fcopy.c L1694 RCopyFrom (RuntimeError) >> >> My question is, what are the set of permissions required to perform a >> postgres copy? >> >> I've set the permissions on the directory so that the postgres group owns >> the directory and has read and execute permissions, as follows: >> drwxrwxr-x 3 ruby_process postgres >> >> I have also tried moving the files to /tmp and performing the copy from >> there, unsuccesfuly. >> >> Any ideas would be appreciated. Thanks, >> -Harold >> >> > Are you connecting to the database as a superuser to run the COPY command? -- Adrian Klaver adrian.klaver@gmail.com