On Nov 5, 11:03 am, Sunny Hirai <[EMAIL PROTECTED]> wrote:
> Hi Jeremy,
>
> 2.7 does work better but I found a bug with Database#table_exists?.
> Tried to look at the source but I think you'd probably be able to fix
> it in 1% of the time it would take me.
>
>   # FAILURE HERE
>   #
>   # table_exists does not work with identifier. This method call
> incorrectly
>   # returns false even though we just created the table.
>   db.table_exists?( :my__table.identifier )
>
>   # SOME INSIGHT HERE
>   #
>   # table_exists does work with #lit, but it probably shouldn't.
>   db.table_exists?( 'my__table'.lit )

It appears to be due to an optimization that doesn't work unless you
give table_exists a String or Symbol.  Try this patch:

diff --git a/lib/sequel_core/database.rb b/lib/sequel_core/database.rb
index b70cce8..90dba15 100644
--- a/lib/sequel_core/database.rb
+++ b/lib/sequel_core/database.rb
@@ -338,12 +338,8 @@ module Sequel
     # Returns true if a table with the given name exists.
     def table_exists?(name)
       begin
-        if respond_to?(:tables)
-          tables.include?(name.to_sym)
-        else
-          from(name).first
-          true
-        end
+        from(name).first
+        true
       rescue
         false
       end

This makes a couple of specs fail, but those specs are relying on
internal behavior and probably shouldn't exist.  Anyway, please test
this patch.  If it works, I'll apply it and remove the offending
specs.

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