Skip to content

Bug related to 32 bit Integers? #207

@bramtayl

Description

@bramtayl

I think there might be a bug in SQLite related to 32 bit integers. You can trigger it by running this code with QuerySQLite on master on 32 bit Linux

using Test: @test
using QuerySQLite
using Query: @map
using DataValues: DataValue
database = Database(joinpath(pathof(QuerySQLite) |> dirname |> dirname, "test", "Chinook_Sqlite.sqlite"));
result = database.Track |> @map({a = rand(BySQL(_), Int)});
@test collect(result)[1].a isa DataValue{Int}

Here's the stacktrace I get:

│ ERROR: InexactError: trunc(Int32, -342205098811609859)
│ Stacktrace:
│  [1] throw_inexacterror(::Symbol, ::Type{Int32}, ::Int64) at ./boot.jl:560
│  [2] checked_trunc_sint at ./boot.jl:582 [inlined]
│  [3] toInt32 at ./boot.jl:619 [inlined]
│  [4] Type at ./boot.jl:709 [inlined]
│  [5] convert at ./number.jl:7 [inlined]
│  [6] sqlitevalue(::Type{Int32}, ::Ptr{Nothing}, ::Int32) at /home/runner/.julia/packages/SQLite/6uY89/src/SQLite.jl:273
│  [7] getvalue(::QuerySQLite.SQLiteCursor{NamedTuple{(:a,),Tuple{DataValue{Int32}}}}, ::Int32, ::Type{DataValue{Int32}}) at /home/runner/work/QuerySQLite.jl/QuerySQLite.jl/src/iterate.jl:53
│  [8] macro expansion at /home/runner/work/QuerySQLite.jl/QuerySQLite.jl/src/iterate.jl:0 [inlined]
│  [9] generate_namedtuple(::Type{NamedTuple{(:a,),Tuple{DataValue{Int32}}}}, ::QuerySQLite.SQLiteCursor{NamedTuple{(:a,),Tuple{DataValue{Int32}}}}) at /home/runner/work/QuerySQLite.jl/QuerySQLite.jl/src/iterate.jl:2
│  [10] iterate at /home/runner/work/QuerySQLite.jl/QuerySQLite.jl/src/iterate.jl:62 [inlined]
│  [11] _collect(::UnitRange{Int32}, ::QuerySQLite.SQLiteCursor{NamedTuple{(:a,),Tuple{DataValue{Int32}}}}, ::Base.HasEltype, ::Base.SizeUnknown) at ./array.jl:555
│  [12] collect(::QuerySQLite.SQLiteCursor{NamedTuple{(:a,),Tuple{DataValue{Int32}}}}) at ./array.jl:544
│  [13] collect(::QuerySQLite.SourceCode{SQLite.DB}) at /home/runner/work/QuerySQLite.jl/QuerySQLite.jl/src/iterate.jl:90
│  [14] top-level scope at /home/runner/work/QuerySQLite.jl/QuerySQLite.jl/test/runtests.jl:12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions