reassign 397531 sqlite3 found 3.3.8-3 nofound 3.3.7-1 thanks Well,
I reverted the packages to sqlite 3.3.7-1 using snapshot.debian.net and it works. Even worse. I check the output of information that's used by the sqlite adapter to grab the information and both informations are the same. ,----[ activerecord/lib/active_record/schema_dumper.rb ] | columns.each do |column| | raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" if @types[column.type].nil? | next if column.name == pk | tbl.print " t.column #{column.name.inspect}, #{column.type.inspect}" | tbl.print ", :limit => #{column.limit.inspect}" if column.limit != @types[column.type][:limit] | tbl.print ", :default => #{column.default.inspect}" if !column.default.nil? | tbl.print ", :null => false" if !column.null | tbl.puts | end `---- So column is returning not nil. For it: ,----[ active_record/connection_adapters/sqlite_adapter.rb ] | def columns(table_name, name = nil) #:nodoc: | table_structure(table_name).map do |field| | SQLiteColumn.new(field['name'], field['dflt_value'], field['type'], field['notnull'] == "0") | end | end `---- dflt_value is set to something. The strange thing is the following: ,----[ active_record/connection_adapters/sqlite_adapter.rb ] | def table_structure(table_name) | returning structure = execute("PRAGMA table_info(#{table_name})") do | raise ActiveRecord::StatementInvalid if structure.empty? | end | end `---- So I grabbed the sqlite3 3.3.7 and 3.3.8 source codes and analised the diff between both. I identified that it's not related to rails but a wrong change made on sqlite3. So I'm reassigning the bug. libsqlite3-0 changed the returned value when there's no default value. Is possible to make a workaround for this behaviour using '' or nil? as no default value but I don't think it's the right fix. ,----[ diff -Nur sqlite-3.3.7/ sqlite-3.3.8/ | filterdiff -i '*pragma.c' ] | @@ -482,12 +482,19 @@ | sqlite3VdbeSetColName(v, 5, COLNAME_NAME, "pk", P3_STATIC); | sqlite3ViewGetColumnNames(pParse, pTab); | for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){ | + const Token *pDflt; | + static const Token noDflt = { (unsigned char*)"", 0, 0 }; | sqlite3VdbeAddOp(v, OP_Integer, i, 0); | sqlite3VdbeOp3(v, OP_String8, 0, 0, pCol->zName, 0); | sqlite3VdbeOp3(v, OP_String8, 0, 0, | pCol->zType ? pCol->zType : "", 0); | sqlite3VdbeAddOp(v, OP_Integer, pCol->notNull, 0); | - sqlite3ExprCode(pParse, pCol->pDflt); | + pDflt = pCol->pDflt ? &pCol->pDflt->span : &noDflt; | + if( pDflt->z ){ | + sqlite3VdbeOp3(v, OP_String8, 0, 0, (char*)pDflt->z, pDflt->n); | + }else{ | + sqlite3VdbeAddOp(v, OP_Null, 0, 0); | + } | sqlite3VdbeAddOp(v, OP_Integer, pCol->isPrimKey, 0); | sqlite3VdbeAddOp(v, OP_Callback, 6, 0); | } `---- Even if we want to workaround it, the right place to do that is libsqlite3-ruby and not on rails itself. -- O T A V I O S A L V A D O R --------------------------------------------- E-mail: [EMAIL PROTECTED] UIN: 5906116 GNU/Linux User: 239058 GPG ID: 49A5F855 Home Page: http://www.freedom.ind.br/otavio --------------------------------------------- "Microsoft gives you Windows ... Linux gives you the whole house." -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]