Question : A while ago, I spent a nightmarish number of weeks dealing with “deadlock detected” and trying to figure […]
Tag: error-handling
Can I let PostgreSQL report the offending rows when a multi-row INSERT fails?
Question : When inserting multiple rows into a table by a single INSERT INTO invocation, and the INSERT statement fails […]
Long time, sporadic ‘String or Binary data would be truncated.’ Wisdom would be appreciated
Question : TL;DR How can I diagnose the source of a very inconsistent, un-reproducable ‘String or Binary data would be […]
Does the “don’t use errors for flow control” axiom apply to postgres?
Question : In traditional programming there is an axiom that states, “do not use errors for flow control”. A general […]
How can I handle unwanted, non-erroneous situations better?
Question : When writing procedures, I occasionally encounter situations in which I want to abort the procedure, even if the […]
Need to Check if a Table Exists Before Deleting a Record
Question : I have the following SQL query in my Ruby app: sql = “DELETE FROM `#{database}`.`table1` WHERE `same_id` = […]
BULK INSERT continue on PRIMARY KEY error
Question : I get a CSV file with a several million records every few days. I need to insert them […]
Is there a way to query all error messages in Postgres?
Question : Postgres has a catalogue of possible error messages here: http://www.postgresql.org/docs/8.2/static/errcodes-appendix.html#ERRCODES-TABLE However, I would like to query this information […]
Impossible to log errors after dooming a transaction within an INSERT-EXEC statement
Question : We have a stored procedure that does some work within a transaction, wrapped within a stored procedure that […]
Pros and Cons of Checking if value exist for unique column or let db raise unique error on inserting
Question : While writing a query other day a thought came to me and have stuck in my mind. What […]