Re: generic copy options - Mailing list pgsql-hackers

From Dan Colish
Subject Re: generic copy options
Date
Msg-id 20090917185028.GA2811@funkstrom.spiretech.com
Whole thread Raw
In response to Re: generic copy options  (Emmanuel Cecchet <manu@asterdata.com>)
Responses Re: generic copy options
List 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 itsfailing regression tests. Here's the regression.diff. I'm
goingtospend some time today trying to figure out if the tests need tochange of there is an actual issue in the patch.
Justwanted to givea 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 *
fromcopytest 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_escapeE'\\');
 
! 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
copytestexcept 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_escapeE'\\');
 
! copy copytest2 from '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv, csv_quote '''',
csv_escapeE'\\'); 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 *
fromcopytest 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_escapeE'\\')
 
! \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
copytestexcept 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_escapeE'\\')
 
! \copy copytest2 from '/home/dc0lish/workspace/postgresql/src/test/regress/results/copytest.csv' (csv, csv_quote '''',
csv_escapeE'\\') select * from copytest except select * from copytest2;  style | test | filler
-------+------+--------

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



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Feedback on getting rid of VACUUM FULL
Next
From: Emmanuel Cecchet
Date:
Subject: Re: generic copy options