# Possible bug with sqlite3 win32 gem

**URL:** <https://www.ruby-forum.com/t/possible-bug-with-sqlite3-win32-gem/78492>\
**Category:** Ruby\
**Created:** [December 6, 2006, 8:16am UTC](https://www.ruby-forum.com/t/possible-bug-with-sqlite3-win32-gem/78492 "2006-12-06T08:16:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@dasch](https://www.ruby-forum.com/u/dasch)\
**Post date:** [December 6, 2006, 8:16am UTC](https://www.ruby-forum.com/t/possible-bug-with-sqlite3-win32-gem/78492/1 "2006-12-06T08:16:29Z")

</div>

I know what I’m about to describe is a rails issue - I’ve raised a rails  
ticket (#6768) - I’m raising it here because I think sqlite3-ruby is the  
most likely culprit.

I can reproduce the bug on two windows systems using both  
sqlite3-ruby-1.1.0.1-mswin32 (\_why’s sqlite3 install) and the default  
sqlite3-ruby-1.1.0-mswin32 gem. Cannot reproduce on gentoo system with  
the sqlite3-ruby-1.1.0 gem

Running this migration in rails against an sqlite3 database:

class CreateTestModels \< ActiveRecord::Migration  
def self.up  
create\_table :test\_models do |t|  
t.column :test, :string  
end  
rename\_column :test\_models, :test, :test2  
rename\_column :test\_models, :test2, :test3  
end

def self.down  
drop\_table :test\_models  
end  
end

results in the following schema for a sqlite3 database:

CREATE TABLE schema\_info (version integer);  
CREATE TABLE test\_models (“id” INTEGER PRIMARY KEY NOT NULL, “test3”  
varchar(255) DEFAULT ‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’);

Note the default value - each rename\_column (or anything else that uses  
the duplicate and rename mechanism) results in the default value being  
escaped.

Looking at the rails codebase, when the call is made to look up the  
table schema with PRAGMA table\_info(#{table\_name}), the windows gem  
appears to be returning an escaped string for the default value for a  
column (rails then passes this escaped value back in the creation,  
escaping it first, hence the cascade of quotes).

sqlite guys?
