Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you have multiple unique constraints in the same table then it will spit back the same error code. I want to know the name of the specific constraint that was violated.

Always name your indexes. Always name your constraints.



I mean if you have that many violations that points to other problems, but sure if you are in that situation I can see how catching by name might be helpful. It's not a panacea.


It's not that hard to just name the things you care about instead of relying on auto-generated stuff from the database. PG lets you do this easily.

> if you have that many violations that points to other problems

No, it doesn't. This is a sophisticated design choice. You might be out of your depth here.


Okey dokey mate, you do you. Have a great one.


This is a great book that explains PG in a step-by-step way. I learned a ton from it

https://theartofpostgresql.com/


I'm aware of it thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: