RubyOnRails build 8856 failed

The build failed.

CHANGES

CHANGES ------- Revision 8856 committed by nzkoz on 2008-02-11 02:50:58 Fix eager loading with pre-quoted table names. Closes #11046 [danielmorrison, Koz, Jeremy Kemper]

  M /trunk/activerecord/lib/active_record/associations.rb   M /trunk/activerecord/test/cases/associations/eager_test.rb

OK, I can change the regexp to make it more like it was before, but I'm confused by the generated SQL.

Can anyone with postgresql confirm the current failure goes away with the attached patch?

But I can't follow why it's generating "posts.id" which I assume isn't equivalent to "posts"."id". Anyone want to take a stab?

fix-postgresql-maybe.diff (1.32 KB)

The test says:

:order => Comment.connection.quote_table_name(‘posts.id’)

Which is totally weird (I can’t think of why the test is written like that). MySQL adapter is actually the only adapter that takes care of the period inside the “table name” (I can’t think of why it does that, either–the whole point of quoting is escaping special characters in a query).

def quote_table_name(name) #:nodoc: @quoted_table_names[name] ||= quote_column_name(name).gsub(‘.’, ‘.’) end

In all other databases, quote_table_name simply uses quote_column_name.

Thanks for that mislav, sometimes it's hard to see the forest for the trees :slight_smile:

Well, there is still an issue of quote_table_name in mysql adapter doing stuff that it shouldn’t. It shouldn’t detect periods. So is this going to be removed?

Well, there is still an issue of quote_table_name in mysql adapter doing stuff that it shouldn't. It shouldn't detect periods. So is this going to be removed?

Here's where it came from:

http://dev.rubyonrails.org/changeset/7980

Not sure of the merits / alternatives.