[Workaround] Re: [Locomotive-users] Re: SQLite3,
NULL vs 'NULL' problem?
Niko Dittmann
ni-di at web.de
Sun May 27 14:21:41 GMT 2007
24.05.2007, 03:08 Alex Satrapa (thanks for the answer, Alex):
> […]
> The core of the problem is that in SQLite3 3.3.7 would report the
> default value of a column as the actual default value - thus a
> column defined as "DEFAULT NULL" would show up in the schema as
> having NULL in the "default" column (that's the SQL "empty field"
> value). Since 3.3.8, the default column in the schema is populated
> with a string representation of the SQL value, thus a column
> defined as "DEFAULT NULL" will have a row in the schema describing
> the default value as 'NULL' (that's an SQL string containing N-U-L-L).
> […]
Today I stumbled over another problem and I suspect it to be of the
same nature. That's why I didn't use a new thread.
I have a migration setting the default value of a column to "astring":
t.column :column_name, :string, :default=>"astring"
Sqlite now enters "astring" _including_the_quotes_ into the column.
This concerns the march and the february bundles (both 3.3.13), but
not the january bundle (3.3.7). Unsurprisingly this doesn't concern
mysql.
As a workaround I just copied the sqlite3 binary from the january
bundle (framework/bin) to the march bundle and both glitches - the
'null' as string and the default value in quotes - disappear.
If that's the new standard behaviour of sqlite than the rails sqlite
database adapter needs to be updated, me thinks.
Regards, Niko.
--
____________________________
niko dittmann <ni-di at web.de>
____________________________
More information about the Locomotive-users
mailing list