Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d73lT-0006aZ-PN for pgsql-bugs@arkaria.postgresql.org; Sat, 06 May 2017 17:45:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d73lT-0002iR-AB for pgsql-bugs@arkaria.postgresql.org; Sat, 06 May 2017 17:45:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d73lS-0002gv-H3 for pgsql-bugs@postgresql.org; Sat, 06 May 2017 17:45:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d73lP-00087m-Jf for pgsql-bugs@postgresql.org; Sat, 06 May 2017 17:45:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v46Hj2K7019512; Sat, 6 May 2017 13:45:02 -0400 From: Tom Lane To: john@7fff.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14645: Can't use psql from within program used by "copy ... from program" script? In-reply-to: <20170506171803.24361.76643@wrigleys.postgresql.org> References: <20170506171803.24361.76643@wrigleys.postgresql.org> Comments: In-reply-to john@7fff.com message dated "Sat, 06 May 2017 17:18:03 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19510.1494092702.1@sss.pgh.pa.us> Date: Sat, 06 May 2017 13:45:02 -0400 Message-ID: <19511.1494092702@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org john@7fff.com writes: > copy bug(id) from program '$HOME/bug/data' csv header; > It calls a script called data. I run it with psql -X -f > $HOME/bug/setup.sql > This works for the "data" script: > #/bin/bash > echo "id" > echo "1" > echo "2" > This doesn't: > #/bin/bash > echo "id" > echo "1" > psql -X -t -q -c "select 2" | xargs > I can't figure out if psql is disallowed from the program referenced by the > copy program; or if somehow standard out is getting nuked. I think you're getting messed up by the fact that the program will be run by the server, ie, under the postgres user's login, not your own login. Try capturing psql's stderr to see if it's printing a cant-login type of message. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs