Permalink
Browse files

Fix join_table when doing the first join for a dataset where the firs…

…t source is a dataset when using unqualified columns
  • Loading branch information...
1 parent 022d4dd commit d313c9758b2a7c800ee064e2e06460d6f1580b27 @jeremyevans committed Sep 18, 2008
Showing with 3 additions and 1 deletion.
  1. +2 −0 CHANGELOG
  2. +1 −1 lib/sequel_core/dataset/sql.rb
View
@@ -1,5 +1,7 @@
=== HEAD
+* Fix join_table when doing the first join for a dataset where the first source is a dataset when using unqualified columns (jeremyevans)
+
* Fix a few corner cases in eager_graph (jeremyevans)
* Support transactions on MSSQL (jeremyevans)
@@ -393,7 +393,7 @@ def join_table(type, table, expr=nil, table_alias=nil, &block)
raise(Sequel::Error, "can't use a block if providing an array of symbols as expr") if block_given?
SQL::JoinUsingClause.new(expr, type, table, table_alias)
else
- last_alias = @opts[:last_joined_table] || first_source
+ last_alias = @opts[:last_joined_table] || (first_source.is_a?(Dataset) ? 't1' : first_source)
if Hash === expr or (Array === expr and expr.all_two_pairs?)
expr = expr.collect do |k, v|
k = qualified_column_name(k, table_name) if k.is_a?(Symbol)

0 comments on commit d313c97

Please sign in to comment.