Skip to content

Commit

Permalink
Add COPY TO error test case
Browse files Browse the repository at this point in the history
  • Loading branch information
cmey committed Dec 30, 2021
1 parent ddd06b3 commit e0da87b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,24 @@ end

close(conn)
end

@testset "Wrong COPY TO" begin
conn = LibPQ.Connection("dbname=postgres user=$DATABASE_USER")

# test CopyOut!
databuf = IOBuffer()
copyout = LibPQ.CopyOut!(databuf, "SELECT libpqjl_test;")

result = execute(conn, copyout; throw_error=false)
@test isopen(result)
@test status(result) == LibPQ.libpq_c.PGRES_FATAL_ERROR

err_msg = LibPQ.error_message(result)
@test occursin("ERROR", err_msg)
close(result)

close(conn)
end
end

@testset "LibPQ.Connection" begin
Expand Down

0 comments on commit e0da87b

Please sign in to comment.