Skip to content

Commit 671be66

Browse files
committed
Add COPY TO error test case
1 parent fa51788 commit 671be66

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/runtests.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,24 @@ end
501501

502502
close(conn)
503503
end
504+
505+
@testset "Wrong COPY TO" begin
506+
conn = LibPQ.Connection("dbname=postgres user=$DATABASE_USER")
507+
508+
# test CopyOut!
509+
databuf = IOBuffer()
510+
copyout = LibPQ.CopyOut!(databuf, "SELECT libpqjl_test;")
511+
512+
result = execute(conn, copyout; throw_error=false)
513+
@test isopen(result)
514+
@test status(result) == LibPQ.libpq_c.PGRES_FATAL_ERROR
515+
516+
err_msg = LibPQ.error_message(result)
517+
@test occursin("ERROR", err_msg)
518+
close(result)
519+
520+
close(conn)
521+
end
504522
end
505523

506524
@testset "LibPQ.Connection" begin

0 commit comments

Comments
 (0)