This project is archived and is in readonly mode.
fix for a transaction problem with change_column on postgresql if bad arguments passed in
Reported by azimux | August 19th, 2008 @ 09:19 PM | in 2.x
If you do something like this:
SomeModel.transaction do
<A: some queries/statements that alter database>
change_column :table, :column, :null => false
<B: some more queries/statements that alter database>
end
Then the statements in A will be rolled back but the statements in B will be committed, and this happens without any errors or warnings whatsoever, and causes some confusion.
Notice how I forgot to add the column type to the change_column call, causing change_column to build an invalid statement (it tries to use 'nullfalse' as the datatype), but this exception is gobbled up by change_column which then does some transactional work of it's own, giving the said undesired side effects.
This code is there to handle some problem with pg version 7.x. This patch reraises the exception if the postgresql_version is > 80000, which means the above code raises an exception as it should.
Comments and changes to this ticket
-
Repository August 21st, 2008 @ 04:25 PM
- State changed from new to resolved
(from [0d74e72e6de7b96e158950a449ea1ccce6f5b8d7]) Fix postgres bug when change_column is called with invalid parameters. [#861 state:resolved]
Signed-off-by: Tarmo Tänav tarmo@itech.ee Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
-
Repository August 22nd, 2008 @ 02:16 AM
(from [09343166ac213e5fcbd3eb5b21d44606b56afa62]) PostgreSQL: fix transaction bug that can occur if you call change_column with invalid parameters
[#861 state:resolved] http://github.com/rails/rails/co...
-
Repository August 25th, 2008 @ 09:30 AM
(from [6e71a3552921836590ef7b60334cbf92a2f49d1e]) PostgreSQL: fix transaction bug that can occur if you call change_column with invalid parameters
[#861 state:resolved] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 861 fix for a transaction problem with change_column on postgresql if bad arguments passed in (from [0d74e72e6de7b96e158950a449ea1ccce6f5b8d7]) Fix pos...
- 861 fix for a transaction problem with change_column on postgresql if bad arguments passed in [#861 state:resolved] http://github.com/rails/rails/co...
- 861 fix for a transaction problem with change_column on postgresql if bad arguments passed in [#861 state:resolved] http://github.com/rails/rails/co...