Can someone tell me why this patch is important? http://dev.rubyonrails.org/ticket/4251 """ I think the name says it all. Basically we are taking LEFT OUTER JOIN dbo.Users AS dbo.Users and making it LEFT OUTER JOIN dbo.Users AS Users. """ Do the aliases cause issues if they have periods in them? Would I be potentially hurting folks using tables owned by different users? FWIW it would probably be a simple change with the new #table_alias_for method: http://dev.rubyonrails.org/browser/trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb#L16 -- Rick Olson http://techno-weenie.net
Yeah, you can''t have a period in an Alias. I don''t see how this would hurt anyone but maybe it would be better to replace the periods with underscores instead of loosing the owner name completely. Jeff Rick Olson wrote:> Can someone tell me why this patch is important? > http://dev.rubyonrails.org/ticket/4251 > > """ > I think the name says it all. > > Basically we are taking LEFT OUTER JOIN dbo.Users AS dbo.Users and > making it LEFT OUTER JOIN dbo.Users AS Users. > """ > > Do the aliases cause issues if they have periods in them? Would I be > potentially hurting folks using tables owned by different users? > > FWIW it would probably be a simple change with the new #table_alias_for method: > > http://dev.rubyonrails.org/browser/trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb#L16 > > -- > Rick Olson > http://techno-weenie.net > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core > >
What about surrounding the AS clause with square brackets, like "dbo.Users AS [dbo.Users] ? On 3/20/06, Jeff Berg <jeff@ministrycentered.com> wrote:> Yeah, you can't have a period in an Alias. I don't see how this would > hurt anyone but maybe it would be better to replace the periods with > underscores instead of loosing the owner name completely. > > Jeff > > Rick Olson wrote: > > Can someone tell me why this patch is important? > > http://dev.rubyonrails.org/ticket/4251 > > > > """ > > I think the name says it all. > > > > Basically we are taking LEFT OUTER JOIN dbo.Users AS dbo.Users and > > making it LEFT OUTER JOIN dbo.Users AS Users. > > """ > > > > Do the aliases cause issues if they have periods in them? Would I be > > potentially hurting folks using tables owned by different users? > > > > FWIW it would probably be a simple change with the new #table_alias_for method: > > > > http://dev.rubyonrails.org/browser/trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb#L16 > > > > -- > > Rick Olson > > http://techno-weenie.net > > _______________________________________________ > > Rails-core mailing list > > Rails-core@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > > > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >_______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
On 3/21/06, Ed C. <defeated2k4@gmail.com> wrote:> What about surrounding the AS clause with square brackets, like > "dbo.Users AS [dbo.Users] ?Rails truncates table alias names in one spot, making this a dead simple change to make. Try this in a plugin: ActiveRecord::ConnectionAdapters::SQLServerAdapter.class_eval do def table_alias_for(table_name) "[#{super}]" end end I added a patch to #4251. Please try it and let me know if it works out: http://dev.rubyonrails.org/attachment/ticket/4251/table_alias_owner.diff It converts .''s to _''s. -- Rick Olson http://techno-weenie.net