postgrest-docs icon indicating copy to clipboard operation
postgrest-docs copied to clipboard

pinpoint faulty row in bulk insert

Open steve-chavez opened this issue 1 year ago • 0 comments

From gitter:

hi I recently started to use Postgres, and I am uploading a long CSV file which contains some errors, such as duplicates; Postgrest tells me that something is violating the unique constraint of a column, but I do not know which row is the problematic one; do you have any idea how to provide such information to the client?

that is great, thank you! I made this code (for future reference): exception when others then raise exception using errcode = sqlstate, message = sqlerrm, detail = new;

Basically is sending the new row in the detail of the error. This seems generally useful.

Look into making it a how-to or perhaps include in core?

steve-chavez avatar Apr 25 '23 21:04 steve-chavez