Re: [racket] racket/db exception handling and unmanaged transactions with postgres

2015-01-20 Thread Thomas Lynch
p.s. here is my as-transaction macro for wrapping code in transaction blocks. The idea here is to make sure transactions begin and commit/rollback is paired even in the presence of exceptions. This macro also deals with sharing the connection between threads, thus the semaphore. The db calls can

Re: [racket] racket/db exception handling and unmanaged transactions with postgres

2015-01-20 Thread Thomas Lynch
Thankyou Ryan. I also changed to the managed transaction approach and it is working well. It is a great library, and simple to use. IMHO the library should not do a rollback or require one after an exception, as a query failure is information that can be acted on, i.e. a program might use the in

Re: [racket] racket/db exception handling and unmanaged transactions with postgres

2015-01-20 Thread Ryan Culpepper
On 01/20/2015 06:53 AM, Thomas Lynch wrote: According to the manual, http://docs.racket-lang.org/db/query-api.html#%28part._transactions%29, section 3.5, postgres transactions can be issued directly in SQL (so called 'unmanaged'). Here is a short code segment that fails doing unmanaged tran

Re: [racket] racket/db exception handling and unmanaged transactions with postgres

2015-01-20 Thread George Neuner
Hi Thomas, On 1/20/2015 6:53 AM, Thomas Lynch wrote: For purposes of illustration, I run the following query here in the psql shell to show the the error message that it correctly issues: => insert into x_unique_counters values ('table_author','1'); ERROR: duplicate key value violates