Bug 4289 - Inserting a UInt32.MaxValue into a BigInt column fails
Summary: Inserting a UInt32.MaxValue into a BigInt column fails
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Data.Sqlite ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-04-06 08:02 UTC by Matthew Leibowitz
Modified: 2012-10-27 08:12 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 4289 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Matthew Leibowitz 2012-04-06 08:02:48 UTC
This function fails with System.OverflowException : Value was either too large or too small for an Int32.

public void StartMaxTest()
    var conn = new SqliteConnection("Data Source="+System.IO.Path.GetTempFileName());

    var cmd = conn.CreateCommand();
    cmd.CommandText = "CREATE TABLE [Test] ([UInt32] BIGINT NOT NULL);";

    cmd.CommandText = "INSERT INTO [Test] VALUES (?);";
    var p = cmd.CreateParameter();
    p.Value = UInt32.MaxValue;


If I change one line to:
    p.Value = (long) UInt32.MaxValue;
it works correctly. It seems to be mapping a UInt32 to a Int32 instead of Int64.

This functionality works correctly on the Community.CsharpSqlite version. (Even though you don't maintain this one, I thought I'd let you guys know anyway.)

Stack Trace of exception:

System.OverflowException : Value was either too large or too small for an Int32.
at System.Convert.ToInt32(UInt32 value)
at System.UInt32.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ToInt32(Object value, IFormatProvider provider)
at Mono.Data.Sqlite.SqliteStatement.BindParameter(Int32 index, SqliteParameter param)
at Mono.Data.Sqlite.SqliteStatement.BindParameters()
at Mono.Data.Sqlite.SqliteCommand.BuildNextCommand()
at Mono.Data.Sqlite.SqliteCommand.GetStatement(Int32 index)
at Mono.Data.Sqlite.SqliteDataReader.NextResult()
at Mono.Data.Sqlite.SqliteDataReader..ctor(SqliteCommand cmd, CommandBehavior behave)
at Mono.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Mono.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Mono.Data.Sqlite.Orm.Tests.ColumnTypesTest.StartMaxTest() in ColumnTypesTest.cs: line 62
Comment 1 Matthew Leibowitz 2012-10-27 08:11:50 UTC
A pull on github: https://github.com/mono/mono/pull/438
closed on github 10/10/2012

When will this be pulled into the monotouch/monodroid builds?