Peter Eisentraut writes:
 >
 > [Patch to make psql's \copy read from the current input, not just
 >  the standard input or a file.]
 > 
 > I'm not sure about the proposed syntax, but the feature sounds quite 
 > reasonable.

I have a patch written for this that uses the "-" syntax:

    \copy junk (abbrev, name) FROM - WITH DELIMITER '|' NULL ''

I considered a half-dozen or so different ways to go about it, and
this one fits in without breaking anything that already exists.  The
hyphen seems like the best choice to go with STDIN and STDOUT since
there are already other programs where it implies the default input
stream and it's not something likely to be found alone as a filename.
If you find something you like better, changing it to something else
is a matter of tweaking a string in copy.c.

The patch will be posted to pgsql-patches as soon as I've had a chance
to torture it some more.

                                                        - Mark
-- 
"Debugging is twice as hard as writing the code in the first
 place. Therefore, if you write the code as cleverly as possible, you
 are, by definition, not smart enough to debug it."  -- Brian  Kernighan

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to