# Sqlite3-ruby 64bit bug

**URL:** <https://www.ruby-forum.com/t/sqlite3-ruby-64bit-bug/129270>\
**Category:** Ruby\
**Created:** [February 15, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/sqlite3-ruby-64bit-bug/129270 "2008-02-15T23:15:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremyheiler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jeremyheiler](https://www.ruby-forum.com/u/jeremyheiler)\
**Post date:** [February 15, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/sqlite3-ruby-64bit-bug/129270/1 "2008-02-15T23:15:19Z")

</div>

Hey all,

It appears that I have found a bug in sqlite3-ruby relating to 64bit  
integer inserts.

```
http://rubyforge.org/tracker/index.php?func=detail&aid=18087&group_id=254&atid=1043

```

I figured I should say something here in case someone else hits it too.  
There  
is a patch attached to the above ticket that works for me, but may not  
be the  
best solution for the issue.

If you are inserting into a column, and the value is greater than a C  
‘int’ but  
still a Ruby Fixnum, you will see an exception.

I’ve attached a program that you can use to test to see if you are  
affected.

```
$ ruby sqlite-64bit-test.rb
Ruby : 1.8.6 (2007-09-24 

```

patchlevel 111) [x86\_64-linux]  
system maximumn ‘int’ : 1073741823  
Last Fixnum : 4611686018427387903 is a  
Fixnum  
First Bignum : 4611686018427387904 is a  
Bignum  
Insert 1073741823 into sqlite : Succeeded (returned  
1073741823 as a String)  
Insert 4611686018427387904 into sqlite : Succeeded (returned  
4611686018427387904 as a String)  
Insert 4611686018427387903 into sqlite : Failed because integer  
4611686018427387903 too big to convert to `int’

enjoy,

-jeremy
