Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

drop_table to support temporary option like create_table

#2943

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

Reported by Rob Aldred · July 23rd, 2009 @ 04:09 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Rob Aldred
    Rob Aldred

    looks like lighthouse doesn't like my file...
    http://gist.github.com/153070

    July 23rd, 2009 @ 04:21 PM

  2. Michael Koziarski
    Michael Koziarski
    • Tag changed from activerecord, sql, testing to activerecord, bugmash, sql, testing

    August 3rd, 2009 @ 06:06 AM

  3. dira
    dira

    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.

    August 8th, 2009 @ 12:35 PM

  4. Dan Pickett
    Dan Pickett

    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

    August 9th, 2009 @ 12:11 AM

  5. Rizwan Reza
    Rizwan Reza

    -1 on this from me too. I think this should be adapter specific, IMHO.

    August 9th, 2009 @ 04:51 AM

  6. Elad Meidar
    Elad Meidar

    -1 here too, classic adapter.

    August 10th, 2009 @ 12:40 AM

  7. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from activerecord, bugmash, sql, testing to activerecord, sql, testing
    • State changed from new to wontfix

    Seems a consensus here.

    August 10th, 2009 @ 02:33 AM

  8. Rob Aldred
    Rob Aldred
    • 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.

    August 10th, 2009 @ 10:30 AM