Re: COPY enhancements
От | Emmanuel Cecchet |
---|---|
Тема | Re: COPY enhancements |
Дата | |
Msg-id | 4AAA4DA3.4010006@asterdata.com обсуждение исходный текст |
Ответ на | Re: COPY enhancements (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: COPY enhancements
(Tom Lane <tgl@sss.pgh.pa.us>)
|
Список | pgsql-hackers |
Hi Robert,<br /><br /><blockquote cite="mid:603c8f070909101953y44c262ffn4ea744d235054ab3@mail.gmail.com" type="cite"><prewrap="">I like this idea, perhaps not surprisingly (for those not following at home: that was my patch). Unfortunately, it looks to me like there is no way to do this without overhauling the syntax. If the existing syntax required a comma between options (i.e. "copy blah to stdout binary, oids" rather than "copy to stdout binary oids", this would be pretty straightforward; but it doesn't even allow one). </pre></blockquote> Well some options like CSV FORCE ... take a commaseparated list of columns. This would require all options to become reserved keywords or force parenthesis around optionparameters.<br /><blockquote cite="mid:603c8f070909101953y44c262ffn4ea744d235054ab3@mail.gmail.com" type="cite"><prewrap="">I wonder if we should consider allowing COPY options to be comma-separated beginning with 8.5, and then require it in 8.6. Other options include continuing to support the old syntax for the existing options, but allowing some new syntax as well and requiring its use for all new options (this is what we did with EXPLAIN, but there were only two pre-existing options there), and just changing the syntax incompatibly and telling users to suck it up. But I'm not sure I like either of those choices. </pre></blockquote> We could keep the current syntax for backward compatibility only (can be droppedin a future release) and have a new syntax (starting in 8.5). To avoid confusion between both, we could just replaceWITH with something else (or just drop it) to indicate that this is the new syntax.<br /><br /> The new syntax couldlook like:<br /><pre class="SYNOPSIS">COPY <tt class="REPLACEABLE"><i>tablename</i></tt> [ ( <tt class="REPLACEABLE"><i>column</i></tt>[, ...] ) ] FROM { '<tt class="REPLACEABLE"><i>filename</i></tt>' | STDIN } [ [,BINARY ] [, OIDS ] [, DELIMITER [ AS ] '<tt class="REPLACEABLE"><i>delimiter</i></tt>' ] [, NULL [ AS ] '<ttclass="REPLACEABLE"><i>null string</i></tt>' ] [, CSV [ HEADER ] [ QUOTE [ AS ] '<tt class="REPLACEABLE"><i>quote</i></tt>'] [ ESCAPE [ AS ] '<tt class="REPLACEABLE"><i>escape</i></tt>' ] [ FORCE NOT NULL (<tt class="REPLACEABLE"><i>column</i></tt> [, ...]) ] [, ERRORS { SKIP | LOGINTO { tablename | 'filename' } [ LABEL label_name ] [ KEY key_name ] [ MAX ERRORS <i>count</i> ] } ] </pre><br /> Is this what you had in mind?<br /><br /> Emmanuel<br /><pre class="moz-signature" cols="72">-- Emmanuel Cecchet Aster Data Systems Web: <a class="moz-txt-link-freetext" href="http://www.asterdata.com">http://www.asterdata.com</a> </pre>
В списке pgsql-hackers по дате отправления: