Re: Allow COPY's 'text' format to output a header

From: Cynthia Shang <cynthia(dot)shang(at)crunchydata(dot)com>
To: Simon Muller <samullers(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allow COPY's 'text' format to output a header
Date: 2018-07-25 17:24:08
Message-ID: 7B83395E-F8C4-4570-800F-2A55C34E05CE@crunchydata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 4 July 2018 at 22:44, Simon Muller <samullers(at)gmail(dot)com <mailto:samullers(at)gmail(dot)com>> wrote:
> I noticed through the patch tester link at http://commitfest.cputube.org/ <http://commitfest.cputube.org/> that my patch caused a file_fdw test to fail (since I previously tested only with "make check" and not with "make check-world").
>
> This v2 patch should fix that.
>
> This patch just fixes a newline issue introduced in my previous patch.

I've reviewed this patch and feel this patch addresses the original ask. I tested it manually trying to break it and, as mentioned previously, it's behavior is the same as the CSV copy with regards to it's shortcomings. However, I feel
1) a "copy from" test is needed and
2) the current "copy to" test is (along with a few others) in the wrong file.

With regards to #2, the copy.source tests are for things requiring replacement when running the tests. Given that these copy tests do not, I have moved the current last set of copy tests to the copy2.sql file and have provided an attached patch.

With regards to #1, the patch I have provided can then be used and the following added as the COPY TO/FROM tests (perhaps after line 426 of the attached copy2.sql file). Note that I moved the FROM test before the TO test and omitted the "(format text, header true)" in the FROM test since it is another way the command can be invoked.

copy copytest3 from stdin header;
this is just a line full of junk that would error out if parsed
11 a 1
22 b 2
\.

copy copytest3 to stdout with (format text, header true);

As for the matching check of the header in the discussion of this patch, I feel that is a separate patch that can be added later since it would affect the general functionality of the copy command, not just the ability to have a text header.

Best,
- Cynthia Shang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Cynthia Shang 2018-07-25 17:36:54 Re: Allow COPY's 'text' format to output a header
Previous Message Tomas Vondra 2018-07-25 16:50:06 Re: Optimizer misses big in 10.4 with BRIN index