If you do:

   class User < Sequel::Model
      set_primary_key 'id'
   end

Then:

   users = User[1,2,3,4,5]

You get incorrect SQL:

   SELECT * FROM "USERS" WHERE "ID" = (1, 2, 3, 4, 5)

It's because of this optimization in primary_key_lookup:

      # Find the row in the dataset that matches the primary key.
Uses
      # an static SQL optimization if the table and primary key are
simple.
      def primary_key_lookup(pk)
        if t = simple_table and p = simple_pk
          with_sql("SELECT * FROM #{t} WHERE #{p} = #{dataset.literal
(pk)}").first
        else
          dataset[primary_key_hash(pk)]
        end
      end

Either that optimization could just be removed, or there could be
additional conditions put on it:

        if (pk.is_a?(Fixnum) or pk.is_a?(String)) and t = simple_table
and p = simple_pk

-Nate

--~--~---------~--~----~------------~-------~--~----~
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