Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id EC1C81337B8A for ; Fri, 12 Nov 2010 19:18:10 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 41239-09 for ; Fri, 12 Nov 2010 23:18:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pw0-f46.google.com (mail-pw0-f46.google.com [209.85.160.46]) by mail.postgresql.org (Postfix) with ESMTP id 992ED1337B81 for ; Fri, 12 Nov 2010 19:18:02 -0400 (AST) Received: by pwi9 with SMTP id 9so459943pwi.19 for ; Fri, 12 Nov 2010 15:18:02 -0800 (PST) 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=ikE97jZsL7is4h9dZ+U183XHKF3QQY3qfy/RwmM6E2w=; b=b8WtWe9CBBi/pJL+GVLGD+i7UCr+opHerCEbUfe9WLLgZwU9SyGSDgCuyzUPPki75i PIgbzP7m2vC6VzxdlUlBaU5ocmUxK0Br4jjEPzcRXIfpqL2bXq/hh/S1BYj6HaIuJpfU wtX0Ek/Lbj95ZY+54RYk+vFKtZfHHG0w5lMv0= 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=eEoqqw4oREjWQSu8svrqWHVvlmRmNHPpKRC63hNLgPy8Hbq9LSb8FwiXB5tll2xK7J K4elOBaq85TgftpjULcBVVJWQDzLnL5G+JBv43hV/aaJvY7MJM2kgQG1DvyEf2CgDoRW EckeQc0grg3bRnN07lVl+B6KWANxiobEQuWKo= Received: by 10.142.221.1 with SMTP id t1mr2474504wfg.129.1289603882038; Fri, 12 Nov 2010 15:18:02 -0800 (PST) Received: from [192.168.0.107] (c-24-17-179-185.hsd1.wa.comcast.net [24.17.179.185]) by mx.google.com with ESMTPS id w42sm4498668wfh.15.2010.11.12.15.18.00 (version=SSLv3 cipher=RC4-MD5); Fri, 12 Nov 2010 15:18:01 -0800 (PST) Message-ID: <4CDDCB27.9000004@gmail.com> Date: Fri, 12 Nov 2010 15:17:59 -0800 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: Tarlika Elisabeth Schmitz CC: pgsql-sql@postgresql.org Subject: Re: psql -f COPY from STDIN References: <20101112220340.36a0bc75@dick.coachhouse> In-Reply-To: <20101112220340.36a0bc75@dick.coachhouse> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201011/22 X-Sequence-Number: 34760 On 11/12/2010 02:03 PM, Tarlika Elisabeth Schmitz wrote: > The following command works fine when pasing it to psql via the -c > option: > > cat event.csv | \ > psql -c "COPY (event_id, event_name) FROM STDIN DELIMITER AS ',' NULL > AS ''" > > > When executed from a file via -f, it does nothing (no error messages > either): > > event.sql: > COPY (event_id, event_name) FROM STDIN DELIMITER AS ',' NULL AS '' COPY (event_id, event_name) FROM STDIN DELIMITER AS ',' NULL AS ''; ^ > > cat event.csv | psql -f event.sql > > > > What's the problem? Many thanks in advance. > -- Adrian Klaver adrian.klaver@gmail.com