On Feb 4, 9:29 pm, mwlang88 <[email protected]> wrote:
> puts DB[:aging_variant___av].
>   join(:billing_headers___bh, :bh__billing => :av__billing).
>   update_sql(:av__date_created => :bh__created_date)
>
> =>
> UPDATE `aging_variant` AS `av` INNER JOIN `billing_headers` AS `bh` ON
> (`bh`.`billing` = `av`.`billing`) SET `av__date_created` =
> `bh`.`created_date`
>
> run it =>
> Sequel::DatabaseError: Mysql::Error: Unknown column 'av__date_created'
> in 'field list'
>
> remove the "av" alias:
> DB[:aging_variant___av].
>   join(:billing_headers___bh, :bh__billing => :av__billing).
>   update(:date_created => :bh__created_date)
>
> =>
> Works!

Try this patch:

diff --git a/lib/sequel/dataset/sql.rb b/lib/sequel/dataset/sql.rb
index 072e940..d0daa8a 100644
--- a/lib/sequel/dataset/sql.rb
+++ b/lib/sequel/dataset/sql.rb
@@ -1087,7 +1087,7 @@ module Sequel
         values = values.merge(opts[:overrides]) if opts[:overrides]
         # get values from hash
         values.map do |k, v|
-          "#{[String, Symbol].any?{|c| k.is_a?(c)} ?
quote_identifier(k) : literal(k)} = #{literal(v)}"
+          "#{k.is_a?(String) && !k.is_a?(LiteralString) ?
quote_identifier(k) : literal(k)} = #{literal(v)}"
         end.join(COMMA_SEPARATOR)
       else
         # copy values verbatim

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to