Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Another option is to just print the sed command that would strip off the
> > \r from the end of the line.
>
> You keep on assuming that a mechanical fix is possible when a file's
> been munged. It is *NOT*. There is no reliable way to tell whether a
> \r was part of the original data or was added by a newline converter.
> We will not do anyone a service by printing a message that falsely
> suggests they don't need to think carefully about how to reconstruct
> their data.
>
> The only thing worse than no error message is a misleading error
> message.
Well, if the COPY fails on the last value of the first row, and that
value has a trailing \r, we can be pretty sure. I don't see how your
solution make it fool-proof, except by requiring every COPY file, old
and new, and created, to have CR as \r. That seems too heavy-handed the
other way.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026