Tagged Questions
6
votes
2answers
301 views
Pros and Cons of Checking if value exist for unique column or let db raise unique error on inserting
While writing a query other day a thought came to me and have stuck in my mind.
What is preferable, first checking if a value for a unique column exists and then inserting or insert and let db raise ...
10
votes
1answer
561 views
Generate an exception with a Context
When PostgreSQL throws an exception, there is a line "CONTEXT" like:
ERROR: INSERT has more target COLUMNS than expressions
LINE 3: ...
...