Skip to content

Prepared statement with bignum primary key fails #828

Closed
@fw42

Description

@fw42

I have a MySQL table with a bigint(20) primary key.

Using a query like SELECT * FROM table WHERE id = #{id} works fine.

However, using a prepared statement fails in some cases when the id is too big (bigger than what fits into a Fixnum, it seems).

statement = client.prepare("SELECT * FROM table WHERE id = ?")
statement.execute(18325422643391879579)
RangeError: bignum too big to convert into `long long'

With smaller ids, this same statement works.

Is this a known limitation or a bug?

Converting the id to a string using id.to_s before passing it to execute seems to be a working work around, which makes me think this might be a bug (if it is, I'm happy to take a look at fixing it, just want confirmation).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions