Re: generic copy options

From: Dan Colish <dan(at)unencrypted(dot)org>
To: Emmanuel Cecchet <manu(at)asterdata(dot)com>
Cc: 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:50:28
Message-ID: 20090917185028.GA2811@funkstrom.spiretech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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
-------+------+--------

======================================================================

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Emmanuel Cecchet 2009-09-17 18:56:07 Re: generic copy options
Previous Message Hannu Krosing 2009-09-17 18:45:48 Re: Feedback on getting rid of VACUUM FULL