go-gorm / postgres

GORM PostgreSQL driver
MIT License
234 stars 123 forks source link

feat: foreign key violated error #193

Closed saeidee closed 1 year ago

saeidee commented 1 year ago

What did this pull request do?

For better development the developer-friendly error ForeignKeyViolated has been implemented on the driver so it will translate all ForeignKeyViolatation errors to native gorm error ForeignKeyViolated.

Task 3 of the incomplete feature: https://github.com/go-gorm/gorm/issues/6345

Sangamesh26 commented 7 months ago

Hi @saeidee , in one of my project for foreign key violation, I am getting psql error instead of native gorm error. Error that I got : insert or update on table "table_name" violates foreign key constraint "constraint_name" (SQLSTATE 23503)

Please could you help me understand, what may be the reasons for getting this error instead of GORM error. Thanks

saeidee commented 7 months ago

@Sangamesh26 could you please create an issue with more details potentially with a playground link?