# Ruby DBI transaction support bug?

**URL:** <https://rubytalk.org/t/ruby-dbi-transaction-support-bug/37226>\
**Category:** ruby-talk\
**Created:** [27 April 2007 15:38 UTC](https://rubytalk.org/t/ruby-dbi-transaction-support-bug/37226 "2007-04-27T15:38:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pascal\_Meunier2](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@Pascal\_Meunier2](https://rubytalk.org/u/Pascal_Meunier2)\
**Post date:** [27 April 2007 15:38 UTC](https://rubytalk.org/t/ruby-dbi-transaction-support-bug/37226/1 "2007-04-27T15:38:27Z")

</div>

According to [http://www.kitebird.com/articles/ruby-dbi.html](http://www.kitebird.com/articles/ruby-dbi.html) "Using the  
Ruby DBI Module", the following rollback should work but doesn't:

$DBH['AutoCommit'] = false  
sth = $DBH.prepare("SELECT \* FROM add\_user\_list(?)")  
sth.execute('blahblah')  
$DBH.rollback

where "add\_user\_list" is a stored procedure that inserts a row in a  
table. As a result, user "blahblah" is inserted in the table -- the  
rollback didn't work.

However, this works:

$[DBH.do](http://DBH.do)("BEGIN")  
sth = $DBH.prepare("SELECT \* FROM add\_user\_list(?)")  
sth.execute('blahblah')  
$[DBH.do](http://DBH.do)("ROLLBACK")

and user "blahblah" does not get added to the table.

Fun. Should I report this somewhere in particular?

Thanks

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Pascal\_Meunier](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@Pascal\_Meunier](https://rubytalk.org/u/Pascal_Meunier)\
**Post date:** [27 April 2007 15:54 UTC](https://rubytalk.org/t/ruby-dbi-transaction-support-bug/37226/2 "2007-04-27T15:54:07Z")

</div>

I forgot to mention, this is of course with the last version of DBI,  
0.1.1 on ruby 1.8.6 (2007-03-13 patchlevel 0) [x86\_64-linux] and  
Postgresql.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
