Question: is it possible to get the line number of the file where copy failed?
arajczy opened this issue · 5 comments
Hello,
I would like to re-run file copy excluding the line of the file where the error occurs. Is it possible to get the line number of the file where the copy progress failed?
Thanks
Hello,
as far as I know, the COPY operation is atomic so you would need to re-run the COPY anyway if an error occurs. Am I misunderstanding something ?
Yes, but if I run copy from postgres cli it gives me the erroneaous line number pg-copy-streams does not.
Postgres cli error message:
ERROR: null value in column "DDI" of relation "accounts" violates not-null constraint
DETAIL: Failing row contains ([...]).
CONTEXT: COPY accounts, line 17147: [...]
pg-copy-streams error message:
null value in column "DDI" of relation "accounts" violates not-null constraint
Ok I understand it is more for detecting on which line in the source file the problem is ; or how many rows have been sent before the error.
it would be interesting to know where the postgres cli gets this information from. Is it coming from postgres when the error is received or does the cli keep track of the lines it is sending ?
currently pg-copy-streams
does not track the lines as this would add more work and impact performance.
I have found the answer in error.where
ok thanks for finding the solution !