Re: [BUGS] BUG #14645: Can't use psql from within program used by"copy ... from program" script? - Mailing list pgsql-bugs

From John Norman
Subject Re: [BUGS] BUG #14645: Can't use psql from within program used by"copy ... from program" script?
Date
Msg-id CAGcH5RHAm7E5nGUhexFPH3NehMGx17PKc6yWJQekHc_j0DeU=A@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #14645: Can't use psql from within program used by "copy ... from program" script?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] BUG #14645: Can't use psql from within program used by"copy ... from program" script?  (John Norman <john@7fff.com>)
List pgsql-bugs
Thanks, Tom.

I'm running this all locally on my laptop.

I checkout stdout and stderr: Nothing.

John


On Sat, May 6, 2017 at 12:45 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #14645: Can't use psql from within program used by "copy ... from program" script?
Next
From: John Norman
Date:
Subject: Re: [BUGS] BUG #14645: Can't use psql from within program used by"copy ... from program" script?