Re: generic copy options

From: Emmanuel Cecchet <manu(at)asterdata(dot)com>
To: Emmanuel Cecchet <manu(at)asterdata(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Emmanuel Cecchet <Emmanuel(dot)Cecchet(at)asterdata(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: generic copy options
Date: 2009-09-17 18:56:07
Message-ID: 4AB28647.7020107@asterdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dan,

My bad, I copy/pasted the hard link in output/copy.source instead of
@abs_builddir(at)(dot)
Here is a complete version of the patch with the fix on output/copy.source.

Emmanuel

> On Thu, Sep 17, 2009 at 11:07:33AM -0400, Emmanuel Cecchet wrote:
>
>> Tom Lane wrote:
>>
>>> I wonder though if we couldn't simplify matters. Offhand it seems to me
>>> that psql doesn't need to validate the command's syntax fully. All it
>>> really needs to do is find the target filename and replace it with
>>> STDIN/STDOUT. Could we have it just treat the remainder of the line
>>> literally, and not worry about the details of what the options might be?
>>> Let the backend worry about throwing an error if they're bad.
>>>
>>>
>> New version with the simplified psql. Still supports the 7.3 syntax.
>> I am going to look into porting the other COPY enhancements (error
>> logging and autopartitioning) on this implementation. We might come up
>> with new ideas for the documentation side of things with more options.
>>
>> manu
>>
>> --
>> Emmanuel Cecchet
>> Aster Data Systems
>> Web: http://www.asterdata.com
>>
>>
>
> Hi,
>
> I've been working on a review of this patch and currently its
> failing regression tests. Here's the regression.diff. I'm going to
> spend some time today trying to figure out if the tests need to
> change of there is an actual issue in the patch. Just wanted to give
> a heads up.
>
> --
> --Dan
>
> *** /home/dc0lish/workspace/postgresql/src/test/regress/expected/copy.out 2009-09-17 11:45:04.041818319 -0700
> --- /home/dc0lish/workspace/postgresql/src/test/regress/results/copy.out 2009-09-17 11:45:14.215152558 -0700
> ***************
> *** 72,88 ****
> 1,a,1
> 2,b,2
> -- Repeat the above tests with the new 8.5 option syntax
> ! copy copytest to '/home/manu/workspace/Postgres8.5-COPY/src/test/regress/results/copytest.csv' (csv);
> truncate copytest2;
> ! copy copytest2 from '/home/manu/workspace/Postgres8.5-COPY/src/test/regress/results/copytest.csv' (csv);
> select * from copytest except select * from copytest2;
> style | test | filler
> -------+------+--------
> (0 rows)
>
> truncate copytest2;
> ! copy copytest to '/home/manu/workspace/Postgres8.5-COPY/src/test/regress/results/copytest.csv' (csv, csv_quote '''', csv_escape E'\\');
> ! copy copytest2 from '/home/manu/workspace/Postgres8.5-COPY/src/test/regress/results/copytest.csv' (csv, csv_quote '''', csv_escape E'\\');
> select * from copytest except select * from copytest2;
> style | test | filler
> -------+------+--------
> --- 72,88 ----
> 1,a,1
> 2,b,2
> -- Repeat the above tests with the new 8.5 option syntax
> ! copy copytest to '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv);
> truncate copytest2;
> ! copy copytest2 from '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv);
> select * from copytest except select * from copytest2;
> style | test | filler
> -------+------+--------
> (0 rows)
>
> truncate copytest2;
> ! copy copytest to '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv, csv_quote '''', csv_escape E'\\');
> ! copy copytest2 from '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv, csv_quote '''', csv_escape E'\\');
> select * from copytest except select * from copytest2;
> style | test | filler
> -------+------+--------
> ***************
> *** 95,111 ****
> 1,a,1
> 2,b,2
> -- Repeat the above tests with the new 8.5 option syntax from psql
> ! \copy copytest to '/home/manu/workspace/Postgres8.5-COPY/src/test/regress/results/copytest.csv' (csv)
> truncate copytest2;
> ! \copy copytest2 from '/home/manu/workspace/Postgres8.5-COPY/src/test/regress/results/copytest.csv' (csv)
> select * from copytest except select * from copytest2;
> style | test | filler
> -------+------+--------
> (0 rows)
>
> truncate copytest2;
> ! \copy copytest to '/home/manu/workspace/Postgres8.5-COPY/src/test/regress/results/copytest.csv' (csv, csv_quote '''', csv_escape E'\\')
> ! \copy copytest2 from '/home/manu/workspace/Postgres8.5-COPY/src/test/regress/results/copytest.csv' (csv, csv_quote '''', csv_escape E'\\')
> select * from copytest except select * from copytest2;
> style | test | filler
> -------+------+--------
> --- 95,111 ----
> 1,a,1
> 2,b,2
> -- Repeat the above tests with the new 8.5 option syntax from psql
> ! \copy copytest to '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv)
> truncate copytest2;
> ! \copy copytest2 from '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv)
> select * from copytest except select * from copytest2;
> style | test | filler
> -------+------+--------
> (0 rows)
>
> truncate copytest2;
> ! \copy copytest to '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv, csv_quote '''', csv_escape E'\\')
> ! \copy copytest2 from '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv, csv_quote '''', csv_escape E'\\')
> select * from copytest except select * from copytest2;
> style | test | filler
> -------+------+--------
>
> ======================================================================
>
>

--
Emmanuel Cecchet
Aster Data Systems
Web: http://www.asterdata.com

Attachment Content-Type Size
copy-newsyntax-patch-8.5v5.txt text/plain 43.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dan Colish 2009-09-17 19:07:28 Re: generic copy options
Previous Message Dan Colish 2009-09-17 18:50:28 Re: generic copy options