Обсуждение: Re: [PATCHES] Current-stream read for psql's \copy

Поиск
Список
Период
Сортировка

Re: [PATCHES] Current-stream read for psql's \copy

От
Bruce Momjian
Дата:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> No it doesn't.  EOF will do fine.  The source program doesn't
> >> necessarily have to know anything about COPY, as long as its output is
> >> in a format COPY can cope with (eg, tab-delimited).
> 
> > The current behavior seems quite strange and counter-intuitive.  We
> > might break the code for 1-2 people, but we will make it more
> > predicable for everyone using it.
> 
> I don't think it's acceptable to simply remove the functionality.
> If you wanted to argue about swapping the meanings of STDIN and -
> (as defined by the patch) then we could debate about which way is
> more consistent and whether it's worth breaking backwards compatibility
> to improve consistency.  I could probably be talked into supporting
> that; as you say, we've done that before.  But taking out a useful
> behavior that has been there a long time, simply because you've decided
> it's unintuitive, is not okay.

I will do it by vote, not because _I_ decide it is unintuitive.  And I
don't have to talk _you_ into it, just a majority of developers.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: [PATCHES] Current-stream read for psql's \copy

От
Tom Lane
Дата:
Mark Feit <mfeit@notonthe.net> writes:
> What precipitated the patch in the first place was a need to be able
> to do copies in-line to populate tables with small amounts of initial
> data.

Right, that's clearly useful.  The debate at hand is about the
usefulness of the other behavior.

BTW, pg_dump scripts use COPY FROM STDIN (not \copy) to achieve this
same behavior of reading COPY data from the script file.  Your patch was
thus not strictly necessary, since there was already a way to do what it
did --- but I accepted it anyway, since it seems reasonable that \copy
should be able to do it too.

What Bruce is suggesting is that we remove the old \copy behavior and
make it *only* able to do what COPY FROM STDIN does.  That strikes me
as loss of important functionality ...
        regards, tom lane


Re: [PATCHES] Current-stream read for psql's \copy

От
Mark Feit
Дата:
Bruce Momjian writes:> > I will do it by vote, not because _I_ decide it is unintuitive.  And I> don't have to talk
_you_into it, just a majority of developers.
 

Well, here's my vote on the subject: I purposefully avoided changing
the existing behavior because (a) it would break something I will
still find useful after the patch (b) I really think STDIN should mean
STDIN just as /some/file means /some/file.

What precipitated the patch in the first place was a need to be able
to do copies in-line to populate tables with small amounts of initial
data.  I like that initial data to be neat, readable and easy to
browse/modify without having to mentally filter through a lot of
INSERTs.  I have an automated system that takes a bunch of directories
containing various things like table creation and strings them
together into large SQL scripts to build, clear and destroy a
database.  Previously, I was having to deliver multiple files for
database builds; now I can just deliver one that does everything.
                        - Mark
-- 
"DOS computers ... are by far the most popular, with about 70 millionmachines in use worldwide.  Macintosh fans ...
notethat cockroachesare far more numerous than humans, and that numbers alone do notdenote a higher life form."   --
NewYork Times, November 26, 1991