This project is archived and is in readonly mode.
drop_table to support temporary option like create_table
Reported by Rob Aldred | July 23rd, 2009 @ 04:09 PM | in 2.x
Part of an application I am working on creates and drops
temporary tables for processing data.
I have run in to a few problems where creating and dropping tables
breaks testing with transaction fixtures because calling CREATE
TABLE or DROP TABLE causes an implicit COMMIT.
Any action called using active record after a drop_table in a
test causes the following error:
Mysql::Error: SAVEPOINT active_record_1 does not exist:
ROLLBACK TO SAVEPOINT active_record_1 (ActiveRecord::StatementInvalid)
Using temporary tables does not have this behavior, create_table already has the :temporary options available, I have proposed a patch to drop_table to mimic the :temporary option.
Thanks
--Rob
Comments and changes to this ticket
-
Rob Aldred July 23rd, 2009 @ 04:21 PM
looks like lighthouse doesn't like my file...
http://gist.github.com/153070 -
Michael Koziarski August 3rd, 2009 @ 06:06 AM
- Tag changed from activerecord, sql, testing to activerecord, bugmash, sql, testing
-
dira August 8th, 2009 @ 12:35 PM
The patch should be adapter specific - Postgres does not support DROP TEMPORARY TABLE.
So each adapter should expose supports_drop_temporary?, and the drop_method method should take that into account.
-
Dan Pickett August 9th, 2009 @ 12:11 AM
verified that this patch applies cleanly to master
-1 on the implementation and feature, though - this sounds like it belongs in an adapter specific plugin or gem
If not, it'd be great to have test coverage for the supported adapters and some type of boolean method like dira suggested or some "not supported" messaging for postgres
-
Rizwan Reza August 9th, 2009 @ 04:51 AM
-1 on this from me too. I think this should be adapter specific, IMHO.
-
CancelProfileIsBroken August 10th, 2009 @ 02:33 AM
- Tag changed from activerecord, bugmash, sql, testing to activerecord, sql, testing
- State changed from new to wontfix
Seems a consensus here.
-
Rob Aldred August 10th, 2009 @ 10:30 AM
- Tag changed from activerecord, sql, testing to activerecord, sql, testing
Thanks for your comments, if i get some time, ill patch the mysql adapter and write some tests,
seems there's not much of a call for this so no rush.
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>