From df1e7240a68ebdd075543edb4a31509b377438f9 Mon Sep 17 00:00:00 2001 From: Eric Davies Date: Wed, 9 Dec 2020 11:03:31 -0600 Subject: [PATCH] Add boundserror when indexing into an invalid column --- src/results.jl | 2 +- test/runtests.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/results.jl b/src/results.jl index d171675e..79056902 100644 --- a/src/results.jl +++ b/src/results.jl @@ -506,7 +506,7 @@ The returned value will be `missing` if `NULL`, or will be of the type specified [`column_types`](@ref). """ function Base.getindex(jl_result::Result, row::Integer, col::Integer) - if isnull(jl_result, row, col) + if isnull(jl_result, row, column_number(jl_result, col)) return missing else oid = column_oids(jl_result)[col] diff --git a/test/runtests.jl b/test/runtests.jl index 6e3c8812..816e140e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -916,6 +916,7 @@ end @test data[1][2] == "bar" @test data[2].yes_nulls === missing @test data[2][2] === missing + @test_throws BoundsError data[1].fake_column # columns ct = Tables.columns(result)