This project is archived and is in readonly mode.
Cross-DB Joins Broken for MySQL
Reported by pipegeek | September 26th, 2008 @ 08:35 PM
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.
Comments and changes to this ticket
-
Pratik January 5th, 2009 @ 03:50 PM
- 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
-
CancelProfileIsBroken August 4th, 2009 @ 05:37 PM
- Tag changed from activerecord, bug, mysql to activerecord, bug, bugmash, mysql
-
Tristan Dunn August 9th, 2009 @ 09:32 PM
I have attached a patch for master and 2-3-stable with the change and a test.
-
Elad Meidar August 9th, 2009 @ 09:44 PM
-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.
-
Repository August 9th, 2009 @ 10:39 PM
- State changed from incomplete to committed
(from [7908cfabf7b545707a21e0bd795eb45cf4ea45d6]) No longer require database name for MySQL to allow cross database selects.
[#1122 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/7908cfabf7b545707a21e0bd795eb4... -
Repository August 9th, 2009 @ 10:39 PM
(from [1af9bd58a04d14dc727713d2e581fafebc0e1d96]) No longer require database name for MySQL to allow cross database selects.
[#1122 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/1af9bd58a04d14dc727713d2e581fa... -
Jeremy Kemper August 9th, 2009 @ 10:39 PM
- Tag changed from activerecord, bug, bugmash, mysql to activerecord, bug, mysql
- Milestone cleared.
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
- 1122 Cross-DB Joins Broken for MySQL [#1122 state:committed]
- 1122 Cross-DB Joins Broken for MySQL [#1122 state:committed]