Re: BUG #14645: Can't use psql from within program used by "copy ... from program" script?

From: John Norman <john(at)7fff(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14645: Can't use psql from within program used by "copy ... from program" script?
Date: 2017-05-06 18:13:27
Message-ID: CAGcH5REVXN9k6Osph6wOu_TsgBZF1in6gmUaOdJsXcBe=g-3Mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

(I'm really stumped. I almost got out dtrace but figured it was so weird I
shouldn't get into that.)

On Sat, May 6, 2017 at 12:59 PM, John Norman <john(at)7fff(dot)com> wrote:

> 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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> john(at)7fff(dot)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
>>
>
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-05-06 18:28:04 Re: BUG #14645: Can't use psql from within program used by "copy ... from program" script?
Previous Message John Norman 2017-05-06 17:59:53 Re: BUG #14645: Can't use psql from within program used by "copy ... from program" script?