Re: Let file_fdw access COPY FROM PROGRAM

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Craig Ringer <craig(dot)ringer(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Subject: Re: Let file_fdw access COPY FROM PROGRAM
Date: 2016-09-08 19:44:45
Message-ID: CADkLM=eNZrtJJmB5DN1WgT7bU6tiiyWt2axW-oLFVVnVe4-usw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 6, 2016 at 11:44 PM, Craig Ringer <craig(dot)ringer(at)2ndquadrant(dot)com>
wrote:

> On 7 September 2016 at 11:37, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
> wrote:
> > On Tue, Sep 6, 2016 at 11:24 PM, Craig Ringer <
> craig(dot)ringer(at)2ndquadrant(dot)com>
> > wrote:
> >>
> >> On 7 September 2016 at 11:21, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
> >> wrote:
> >> > On Tue, Sep 6, 2016 at 6:53 PM, Craig Ringer
> >> > <craig(dot)ringer(at)2ndquadrant(dot)com>
> >>
> >> > And the TAP test would detect the operating system and know to create
> an
> >> > FDW
> >> > that has the PROGRAM value 'cat test_data.csv' on Unix, 'type
> >> > test_data.csv'
> >> > on windows, and 'type test_data.csv;1' on VMS?
> >>
> >> Right. Or just "perl emit_test_data.pl" that works for all of them,
> >> since TAP is perl so you can safely assume you have Perl.
> >
> >
> > Thanks. I was mentally locked in more basic OS commands. Am I right in
> > thinking perl is about the *only* OS command you can be sure is on every
> > architecture?
>
> Probably, there's a lot of crazy out there.
>
> TAP tests can be conditionally run based on architecture, but
> something like this is probably worth testing as widely as possible.
>
> --
> Craig Ringer http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

Stylistically, would a separate .pl file for the emitter be preferable to
something inline like

perl -e 'print "a\tb\tcc\t4\n"; print "b\tc\tdd\t5\n"'

?

I'm inclined to go inline to cut down on the number of moving parts, but I
can see where perl's readability is a barrier to some, and either way I
want to follow established patterns.

[*] For those who don't perl, the command prints:

a b cc 4
b c dd 5

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-09-08 19:46:46 Re: Is tuplesort_heap_siftup() a misnomer?
Previous Message Peter Geoghegan 2016-09-08 19:35:56 Re: Is tuplesort_heap_siftup() a misnomer?