windowsisgay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-18 23:13 UTC
Disabling transactions
I recently switched from MySQL to PostgreSQL. It would appear that every time I save an ActiveRecord object rails begins a database transaction before saving it, then commits after inserting the data into the table. The problem with that is that I am getting an this uninformative error: ActiveRecord::StatementInvalid: PGError: ERROR: current transaction is aborted, commands ignored until end of transaction block : INSERT INTO pictures (.... Which tells me nothing about why the INSERT actually failed. Apparently other people have ran into this as well: http://dotnot.org/blog/archives/2005/12/20/and-another-mysql-to-postgres-gotcha/ I''d like to either disable transactions (at least for the sake of functional tests) or still be able to retrieve my error somehow. Any advice on either would be much appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Which PGSQL adapter are you using? I use Postgres with Rails also, and while it does wrap everything in a transaction I don''t get the error your getting. Personally I wouldn''t be turning transactions off, and the error is there for a reason. Make sure your using the postgres-pr (0.4.0) gem. Cam On Jun 19, 9:13 am, "windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I recently switched from MySQL to PostgreSQL. > > It would appear that every time I save an ActiveRecord object rails > begins a database transaction before saving it, then commits after > inserting the data into the table. The problem with that is that I am > getting an this uninformative error: > > ActiveRecord::StatementInvalid: PGError: ERROR: current transaction > is aborted, commands ignored until end of transaction block > : INSERT INTO pictures (.... > > Which tells me nothing about why the INSERT actually failed. > Apparently other people have ran into this as well: > > http://dotnot.org/blog/archives/2005/12/20/and-another-mysql-to-postg... > > I''d like to either disable transactions (at least for the sake of > functional tests) or still be able to retrieve my error somehow. Any > advice on either would be much appreciated.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
windowsisgay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-19 00:13 UTC
Re: Disabling transactions
I tried using the other adapters (postgres-pr, ruby-postgres), but the same thing happens. I should''ve mentioned that this is happening in my functional tests, because I just discovered it''s not happening in development mode. I have use_transactional_fixtures set to false. On Jun 18, 5:32 pm, cammo <mvpaustra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Which PGSQL adapter are you using? I use Postgres with Rails also, and > while it does wrap everything in a transaction I don''t get the error > your getting. Personally I wouldn''t be turning transactions off, and > the error is there for a reason. > Make sure your using the postgres-pr (0.4.0) gem. > > Cam > > On Jun 19, 9:13 am, "windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > I recently switched from MySQL to PostgreSQL. > > > It would appear that every time I save an ActiveRecord object rails > > begins a database transaction before saving it, then commits after > > inserting the data into the table. The problem with that is that I am > > getting an this uninformative error: > > > ActiveRecord::StatementInvalid: PGError: ERROR: current transaction > > is aborted, commands ignored until end of transaction block > > : INSERT INTO pictures (.... > > > Which tells me nothing about why the INSERT actually failed. > > Apparently other people have ran into this as well: > > >http://dotnot.org/blog/archives/2005/12/20/and-another-mysql-to-postg... > > > I''d like to either disable transactions (at least for the sake of > > functional tests) or still be able to retrieve my error somehow. Any > > advice on either would be much appreciated.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
windowsisgay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-19 00:38 UTC
Re: Disabling transactions
Oops, nevermind. I am getting the error in development mode as well. On Jun 18, 6:13 pm, "windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I tried using the other adapters (postgres-pr, ruby-postgres), but the > same thing happens. > > I should''ve mentioned that this is happening in my functional tests, > because I just discovered it''s not happening in development mode. > > I have use_transactional_fixtures set to false. > > On Jun 18, 5:32 pm, cammo <mvpaustra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Which PGSQL adapter are you using? I use Postgres with Rails also, and > > while it does wrap everything in a transaction I don''t get the error > > your getting. Personally I wouldn''t be turning transactions off, and > > the error is there for a reason. > > Make sure your using the postgres-pr (0.4.0) gem. > > > Cam > > > On Jun 19, 9:13 am, "windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > I recently switched from MySQL to PostgreSQL. > > > > It would appear that every time I save an ActiveRecord object rails > > > begins a database transaction before saving it, then commits after > > > inserting the data into the table. The problem with that is that I am > > > getting an this uninformative error: > > > > ActiveRecord::StatementInvalid: PGError: ERROR: current transaction > > > is aborted, commands ignored until end of transaction block > > > : INSERT INTO pictures (.... > > > > Which tells me nothing about why the INSERT actually failed. > > > Apparently other people have ran into this as well: > > > >http://dotnot.org/blog/archives/2005/12/20/and-another-mysql-to-postg... > > > > I''d like to either disable transactions (at least for the sake of > > > functional tests) or still be able to retrieve my error somehow. Any > > > advice on either would be much appreciated.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
windowsisgay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-19 00:42 UTC
Re: Disabling transactions
I''ve also just found out that the INSERT statement works fine when I paste it into psql. On Jun 18, 6:38 pm, "windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Oops, nevermind. I am getting the error in development mode as well. > > On Jun 18, 6:13 pm, "windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > I tried using the other adapters (postgres-pr, ruby-postgres), but the > > same thing happens. > > > I should''ve mentioned that this is happening in my functional tests, > > because I just discovered it''s not happening in development mode. > > > I have use_transactional_fixtures set to false. > > > On Jun 18, 5:32 pm, cammo <mvpaustra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Which PGSQL adapter are you using? I use Postgres with Rails also, and > > > while it does wrap everything in a transaction I don''t get the error > > > your getting. Personally I wouldn''t be turning transactions off, and > > > the error is there for a reason. > > > Make sure your using the postgres-pr (0.4.0) gem. > > > > Cam > > > > On Jun 19, 9:13 am, "windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > I recently switched from MySQL to PostgreSQL. > > > > > It would appear that every time I save an ActiveRecord object rails > > > > begins a database transaction before saving it, then commits after > > > > inserting the data into the table. The problem with that is that I am > > > > getting an this uninformative error: > > > > > ActiveRecord::StatementInvalid: PGError: ERROR: current transaction > > > > is aborted, commands ignored until end of transaction block > > > > : INSERT INTO pictures (.... > > > > > Which tells me nothing about why the INSERT actually failed. > > > > Apparently other people have ran into this as well: > > > > >http://dotnot.org/blog/archives/2005/12/20/and-another-mysql-to-postg... > > > > > I''d like to either disable transactions (at least for the sake of > > > > functional tests) or still be able to retrieve my error somehow. Any > > > > advice on either would be much appreciated.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
windowsisgay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-19 01:01 UTC
Re: Disabling transactions
I found out what is causing it. There are exceptions being thrown in my before_ and after_ callbacks for my model. Can rail re-throw the exception it catches and display that error rather than the one I''m getting now? On Jun 18, 5:13 pm, "windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <windowsis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I recently switched from MySQL to PostgreSQL. > > It would appear that every time I save an ActiveRecord object rails > begins a database transaction before saving it, then commits after > inserting the data into the table. The problem with that is that I am > getting an this uninformative error: > > ActiveRecord::StatementInvalid: PGError: ERROR: current transaction > is aborted, commands ignored until end of transaction block > : INSERT INTO pictures (.... > > Which tells me nothing about why the INSERT actually failed. > Apparently other people have ran into this as well: > > http://dotnot.org/blog/archives/2005/12/20/and-another-mysql-to-postg... > > I''d like to either disable transactions (at least for the sake of > functional tests) or still be able to retrieve my error somehow. Any > advice on either would be much appreciated.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---