There's some confusion as to what the :limit option should mean when
used against integer columns in migrations.

Patch #2900 added support for limits in PostgreSQL mapping mapping
limit < 4 to smallint, > 4 to bigint, and anything else to integer (so
the limit is the number of bytes)

However, the mysql adapter uses limit to specify the 'display width'
in digits, which does nothing to constrain the range of values either
displayed or returned.  However it can break complex queries involving
data longer than the display width is stored (as mysql may assume that
all data is limited by the width parameter).  See
http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html.
Incidentally, the default limit seems to be 11, but eleven digits wont
actually fit in a mysql int column.

So the question is, which is right?  Previously I've always thought of
the mysql adapter as the 'reference' implementation when trying to
improve the sqlserver adapter, but in this case I think it's clearly
wrong.  In fact there's a unapplied patch (#4353) that david seems to
have given his blessing to, fixing the mysql adapter.  Can we assume
this is the way to go?

Tom
_______________________________________________
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to