Is there a way to get the row and column where the INSERT-Statement failed in PostgreSQL?

Viewed 74

I'm trying to insert around 15000 rows with 200 columns in one batch into a table in PostgreSQL (with TimescaleDB extension) via Python by using the psycopg2 library. Some of the values I want to insert might be larger than the table's column datatype allows. This results in: ERROR: smallint out of range, SQL state: 22003 I haven't found a way to get more information about the location of the error to handle it. In MySQL, the column and the row where the error occured is reported back by default and it is even possible to clip the values to the max value of its datatype (which also would be fine). Is there a way to handle this in a similar manner in PostgreSQL?

0 Answers
Related