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.

Cross-DB Joins Broken for MySQL

#1122

Not specifying a database when connecting to a mysql server is allowed. Doing so allows one to refer to tables in different databases on the same server in the same query, which is often useful. Support for this is actually already present in vendor/mysql.rb, but is specifically disabled in connection_adapters/mysql_adapter.rb (if no :database argument is specified to establish_connection, an exception is thrown). Removing this check allows cross-db joins.

Reported by pipegeek · September 26th, 2008 @ 08:35 PM

State: committed
Milestone: none
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • State changed from new to incomplete
    • Assigned user set to Pratik

    Hey,

    The patch is missing tests. AR test suite already creates two databases. I think it should be easy to figure out how to write a test for this using those two test dbs.

    Thanks

    January 5th, 2009 @ 03:50 PM

  2. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from activerecord, bug, mysql to activerecord, bug, bugmash, mysql

    August 4th, 2009 @ 05:37 PM

  3. Tristan Dunn
    Tristan Dunn

    I have attached a patch for master and 2-3-stable with the change and a test.

    August 9th, 2009 @ 09:32 PM

  4. Elad Meidar
    Elad Meidar

    -1 on idea, i don't see why i would require an application level solution to access multiple databases, depends on the need, i can think of several other solutions for the need to support another database connectivity.

    +1 on both patches, applies and passes tests.

    August 9th, 2009 @ 09:44 PM

  5. Repository
    Repository
    • State changed from incomplete to committed

    (from [7908cfabf7b545707a21e0bd795eb45cf4ea45d6]) No longer require database name for MySQL to allow cross database selects.

    [#1122 Cross-DB Joins Broken for MySQL state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/7908cfabf7b545707a21e0bd795eb4...

    August 9th, 2009 @ 10:39 PM

  6. Repository
  7. Jeremy Kemper
    Jeremy Kemper
    • Tag changed from activerecord, bug, bugmash, mysql to activerecord, bug, mysql
    • Milestone cleared.

    August 9th, 2009 @ 10:39 PM